rename producttype to product_type

This commit is contained in:
imperosol 2024-12-18 12:16:24 +01:00
parent 8d643fc6b4
commit 5da27bb266
8 changed files with 29 additions and 24 deletions

View File

@ -52,7 +52,7 @@
%} %}
<li><a href="{{ url('counter:admin_list') }}">{% trans %}General counters management{% endtrans %}</a></li> <li><a href="{{ url('counter:admin_list') }}">{% trans %}General counters management{% endtrans %}</a></li>
<li><a href="{{ url('counter:product_list') }}">{% trans %}Products management{% endtrans %}</a></li> <li><a href="{{ url('counter:product_list') }}">{% trans %}Products management{% endtrans %}</a></li>
<li><a href="{{ url('counter:producttype_list') }}">{% trans %}Product types management{% endtrans %}</a></li> <li><a href="{{ url('counter:product_type_list') }}">{% trans %}Product types management{% endtrans %}</a></li>
<li><a href="{{ url('counter:cash_summary_list') }}">{% trans %}Cash register summaries{% endtrans %}</a></li> <li><a href="{{ url('counter:cash_summary_list') }}">{% trans %}Cash register summaries{% endtrans %}</a></li>
<li><a href="{{ url('counter:invoices_call') }}">{% trans %}Invoices call{% endtrans %}</a></li> <li><a href="{{ url('counter:invoices_call') }}">{% trans %}Invoices call{% endtrans %}</a></li>
<li><a href="{{ url('counter:eticket_list') }}">{% trans %}Etickets{% endtrans %}</a></li> <li><a href="{{ url('counter:eticket_list') }}">{% trans %}Etickets{% endtrans %}</a></li>

View File

@ -315,7 +315,7 @@ class ProductType(OrderedModel):
return self.name return self.name
def get_absolute_url(self): def get_absolute_url(self):
return reverse("counter:producttype_list") return reverse("counter:product_type_list")
def is_owned_by(self, user): def is_owned_by(self, user):
"""Method to see if that object can be edited by the given user.""" """Method to see if that object can be edited by the given user."""

View File

@ -38,7 +38,7 @@ class ProductTypeSchema(ModelSchema):
@staticmethod @staticmethod
def resolve_url(obj: ProductType) -> str: def resolve_url(obj: ProductType) -> str:
return reverse("counter:producttype_edit", kwargs={"type_id": obj.id}) return reverse("counter:product_type_edit", kwargs={"type_id": obj.id})
class SimpleProductTypeSchema(ModelSchema): class SimpleProductTypeSchema(ModelSchema):

View File

@ -14,12 +14,12 @@
{% block content %} {% block content %}
<p> <p>
<a href="{{ url('counter:new_producttype') }}" class="btn btn-blue"> <a href="{{ url('counter:new_product_type') }}" class="btn btn-blue">
{% trans %}New product type{% endtrans %} {% trans %}New product type{% endtrans %}
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
</a> </a>
</p> </p>
{% if producttype_list %} {% if product_types %}
<aside> <aside>
<p> <p>
{% trans %}Product types are in the same order on this page and on the eboutic.{% endtrans %} {% trans %}Product types are in the same order on this page and on the eboutic.{% endtrans %}
@ -46,15 +46,19 @@
class="product-type-list" class="product-type-list"
:aria-busy="loading" :aria-busy="loading"
> >
{%- for t in producttype_list -%} {%- for product_type in product_types -%}
<li x-sort:item="{{ t.id }}"> <li x-sort:item="{{ product_type.id }}">
<i class="fa fa-grip-vertical"></i> <i class="fa fa-grip-vertical"></i>
<a href="{{ url('counter:producttype_edit', type_id=t.id) }}">{{ t }}</a> <a href="{{ url('counter:product_type_edit', type_id=product_type.id) }}">
{{ product_type.name }}
</a>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
</div> </div>
{% else %} {% else %}
{% trans %}There is no product types in this website.{% endtrans %} <p>
{% trans %}There are no product types in this website.{% endtrans %}
</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -121,19 +121,19 @@ urlpatterns = [
name="product_edit", name="product_edit",
), ),
path( path(
"admin/producttype/list/", "admin/product-type/list/",
ProductTypeListView.as_view(), ProductTypeListView.as_view(),
name="producttype_list", name="product_type_list",
), ),
path( path(
"admin/producttype/create/", "admin/product-type/create/",
ProductTypeCreateView.as_view(), ProductTypeCreateView.as_view(),
name="new_producttype", name="new_product_type",
), ),
path( path(
"admin/producttype/<int:type_id>/", "admin/product-type/<int:type_id>/",
ProductTypeEditView.as_view(), ProductTypeEditView.as_view(),
name="producttype_edit", name="product_type_edit",
), ),
path("admin/eticket/list/", EticketListView.as_view(), name="eticket_list"), path("admin/eticket/list/", EticketListView.as_view(), name="eticket_list"),
path("admin/eticket/new/", EticketCreateView.as_view(), name="new_eticket"), path("admin/eticket/new/", EticketCreateView.as_view(), name="new_eticket"),

View File

@ -101,8 +101,9 @@ class ProductTypeListView(CounterAdminTabsMixin, CounterAdminMixin, ListView):
"""A list view for the admins.""" """A list view for the admins."""
model = ProductType model = ProductType
template_name = "counter/producttype_list.jinja" template_name = "counter/product_type_list.jinja"
current_tab = "product_types" current_tab = "product_types"
context_object_name = "product_types"
class ProductTypeCreateView(CounterAdminTabsMixin, CounterAdminMixin, CreateView): class ProductTypeCreateView(CounterAdminTabsMixin, CounterAdminMixin, CreateView):

View File

@ -99,7 +99,7 @@ class CounterAdminTabsMixin(TabedViewMixin):
"name": _("Archived products"), "name": _("Archived products"),
}, },
{ {
"url": reverse_lazy("counter:producttype_list"), "url": reverse_lazy("counter:product_type_list"),
"slug": "product_types", "slug": "product_types",
"name": _("Product types"), "name": _("Product types"),
}, },

View File

@ -4197,20 +4197,20 @@ msgstr "Sans catégorie"
msgid "There is no products in this website." msgid "There is no products in this website."
msgstr "Il n'y a pas de produits dans ce site web." msgstr "Il n'y a pas de produits dans ce site web."
#: counter/templates/counter/producttype_list.jinja:4 #: counter/templates/counter/product_type_list.jinja:4
#: counter/templates/counter/producttype_list.jinja:42 #: counter/templates/counter/product_type_list.jinja:42
msgid "Product type list" msgid "Product type list"
msgstr "Liste des types de produit" msgstr "Liste des types de produit"
#: counter/templates/counter/producttype_list.jinja:18 #: counter/templates/counter/product_type_list.jinja:18
msgid "New product type" msgid "New product type"
msgstr "Nouveau type de produit" msgstr "Nouveau type de produit"
#: counter/templates/counter/producttype_list.jinja:25 #: counter/templates/counter/product_type_list.jinja:25
msgid "Product types are in the same order on this page and on the eboutic." msgid "Product types are in the same order on this page and on the eboutic."
msgstr "Les types de produit sont dans le même ordre sur cette page et sur l'eboutic." msgstr "Les types de produit sont dans le même ordre sur cette page et sur l'eboutic."
#: counter/templates/counter/producttype_list.jinja:28 #: counter/templates/counter/product_type_list.jinja:28
msgid "" msgid ""
"You can reorder them here by drag-and-drop. The changes will then be applied " "You can reorder them here by drag-and-drop. The changes will then be applied "
"globally immediately." "globally immediately."
@ -4218,8 +4218,8 @@ msgstr ""
"Vous pouvez les réorganiser ici. Les changements seront alors immédiatement " "Vous pouvez les réorganiser ici. Les changements seront alors immédiatement "
"appliqués globalement." "appliqués globalement."
#: counter/templates/counter/producttype_list.jinja:58 #: counter/templates/counter/product_type_list.jinja:58
msgid "There is no product types in this website." msgid "There are no product types in this website."
msgstr "Il n'y a pas de types de produit dans ce site web." msgstr "Il n'y a pas de types de produit dans ce site web."
#: counter/templates/counter/refilling_list.jinja:15 #: counter/templates/counter/refilling_list.jinja:15