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

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

View File

@ -38,7 +38,7 @@ class ProductTypeSchema(ModelSchema):
@staticmethod
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):

View File

@ -14,12 +14,12 @@
{% block content %}
<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 %}
<i class="fa fa-plus"></i>
</a>
</p>
{% if producttype_list %}
{% if product_types %}
<aside>
<p>
{% trans %}Product types are in the same order on this page and on the eboutic.{% endtrans %}
@ -46,15 +46,19 @@
class="product-type-list"
:aria-busy="loading"
>
{%- for t in producttype_list -%}
<li x-sort:item="{{ t.id }}">
{%- for product_type in product_types -%}
<li x-sort:item="{{ product_type.id }}">
<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>
{%- endfor -%}
</ul>
</div>
{% else %}
{% trans %}There is no product types in this website.{% endtrans %}
<p>
{% trans %}There are no product types in this website.{% endtrans %}
</p>
{% endif %}
{% endblock %}

View File

@ -121,19 +121,19 @@ urlpatterns = [
name="product_edit",
),
path(
"admin/producttype/list/",
"admin/product-type/list/",
ProductTypeListView.as_view(),
name="producttype_list",
name="product_type_list",
),
path(
"admin/producttype/create/",
"admin/product-type/create/",
ProductTypeCreateView.as_view(),
name="new_producttype",
name="new_product_type",
),
path(
"admin/producttype/<int:type_id>/",
"admin/product-type/<int:type_id>/",
ProductTypeEditView.as_view(),
name="producttype_edit",
name="product_type_edit",
),
path("admin/eticket/list/", EticketListView.as_view(), name="eticket_list"),
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."""
model = ProductType
template_name = "counter/producttype_list.jinja"
template_name = "counter/product_type_list.jinja"
current_tab = "product_types"
context_object_name = "product_types"
class ProductTypeCreateView(CounterAdminTabsMixin, CounterAdminMixin, CreateView):

View File

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