Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix product types filters, menu form and page form.

NyanKiyoshi42ef32b2cf95
diff --git a/saleor/dashboard/menu/forms.py b/saleor/dashboard/menu/forms.py
index 27c54ec68a..ff4071b8ea 100644
--- a/saleor/dashboard/menu/forms.py
+++ b/saleor/dashboard/menu/forms.py
@@ -50,15 +50,15 @@ class MenuItemForm(forms.ModelForm):
Collection.objects.all(), Category.objects.all(),
Page.objects.all()],
fetch_data_url=reverse_lazy('dashboard:ajax-menu-links'), min_input=0,
- required=False)
+ required=False,
+ label=pgettext_lazy('Menu item object to link', 'Link'))
class Meta:
model = MenuItem
fields = ('name', 'url')
labels = {
'name': pgettext_lazy('Menu item name', 'Name'),
- 'url': pgettext_lazy('Menu item url', 'URL'),
- 'linked_object': pgettext_lazy('Menu item object to link', 'Link')}
+ 'url': pgettext_lazy('Menu item url', 'URL')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/saleor/dashboard/page/forms.py b/saleor/dashboard/page/forms.py
index a9d5a2f9ce..72cc639c2a 100644
--- a/saleor/dashboard/page/forms.py
+++ b/saleor/dashboard/page/forms.py
@@ -8,30 +8,35 @@ from ..seo.utils import prepare_seo_description
class PageForm(forms.ModelForm):
-
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- self.fields['seo_description'] = SeoDescriptionField(
- extra_attrs={
- 'data-bind': self['content'].auto_id,
- 'data-materialize': self['content'].html_name})
- self.fields['seo_title'] = SeoTitleField(
- extra_attrs={'data-bind': self['title'].auto_id})
+ content = RichTextField(
+ label=pgettext_lazy('Page form: page content field', 'Content'))
class Meta:
model = Page
- exclude = []
+ exclude = ['created']
widgets = {
- 'slug': forms.TextInput(attrs={'placeholder': 'example-slug'})},
+ 'slug': forms.TextInput(attrs={'placeholder': 'example-slug'})}
labels = {
+ 'title': pgettext_lazy(
+ 'Page form: title field', 'Title'),
+ 'slug': pgettext_lazy('Page form: slug field', 'Slug'),
+ 'available_on': pgettext_lazy(
+ 'Page form: available on which date field', 'Available on'),
'is_visible': pgettext_lazy(
- 'Visibility status indicator', 'Publish')},
+ 'Page form: visibility status indicator', 'Is visible')}
help_texts = {
'slug': pgettext_lazy(
'Form field help text',
'Slug is being used to create page URL')}
- content = RichTextField()
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.fields['seo_description'] = SeoDescriptionField(
+ extra_attrs={
+ 'data-bind': self['content'].auto_id,
+ 'data-materialize': self['content'].html_name})
+ self.fields['seo_title'] = SeoTitleField(
+ extra_attrs={'data-bind': self['title'].auto_id})
def clean_slug(self):
# Make sure slug is not being written to database with uppercase.
diff --git a/saleor/dashboard/product/filters.py b/saleor/dashboard/product/filters.py
index 1cd6e36a32..b80f3c70b3 100644
--- a/saleor/dashboard/product/filters.py
+++ b/saleor/dashboard/product/filters.py
@@ -103,6 +103,16 @@ class ProductTypeFilter(SortedFilterSet):
label=pgettext_lazy('Product type list filter label', 'Sort by'),
fields=PRODUCT_TYPE_SORT_BY_FIELDS.keys(),
field_labels=PRODUCT_TYPE_SORT_BY_FIELDS)
+ product_attributes = ModelMultipleChoiceFilter(
+ label=pgettext_lazy(
+ 'Product type list filter label', 'Product attributes'),
+ name='product_attributes',
+ queryset=ProductAttribute.objects.all())
+ variant_attributes = ModelMultipleChoiceFilter(
+ label=pgettext_lazy(
+ 'Product type list filter label', 'Variant attributes'),
+ name='variant_attributes',
+ queryset=ProductAttribute.objects.all())
class Meta:
model = ProductType