Skip to content

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

Use useful context descriptions for labels

akjanik1176f0d93d70
diff --git a/saleor/dashboard/category/forms.py b/saleor/dashboard/category/forms.py
index 46a1657728..916f951fcf 100644
--- a/saleor/dashboard/category/forms.py
+++ b/saleor/dashboard/category/forms.py
@@ -10,9 +10,13 @@ from ...product.models import Category
class CategoryForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.parent_pk = kwargs.pop('parent_pk')
+<<<<<<< HEAD
super().__init__(*args, **kwargs)
self.fields['is_hidden'].label = pgettext_lazy(
'Category form field label', 'Hide in site navigation')
+=======
+ super(CategoryForm, self).__init__(*args, **kwargs)
+>>>>>>> Use useful context descriptions for labels
if self.instance.parent and self.instance.parent.is_hidden:
self.fields['is_hidden'].widget.attrs['disabled'] = True
@@ -21,16 +25,16 @@ class CategoryForm(forms.ModelForm):
exclude = ['slug']
labels = {
'name': pgettext_lazy(
- 'Category field',
+ 'Category name',
'Name'),
'description': pgettext_lazy(
- 'Category field',
+ 'Category description',
'Description'),
'is_hidden': pgettext_lazy(
- 'Category field',
- 'Hide in navigation'),
+ 'Hide in site navigation',
+ 'Hide in site navigation'),
'parent': pgettext_lazy(
- 'Category field',
+ 'Category parent',
'Category parent')}
def save(self, commit=True):
diff --git a/saleor/dashboard/discount/forms.py b/saleor/dashboard/discount/forms.py
index b288529c59..59e86bc3d6 100644
--- a/saleor/dashboard/discount/forms.py
+++ b/saleor/dashboard/discount/forms.py
@@ -23,19 +23,19 @@ class SaleForm(forms.ModelForm):
exclude = []
labels = {
'name': pgettext_lazy(
- 'Sale form label',
+ 'Sale name',
'Name'),
'type': pgettext_lazy(
- 'Sale form label',
+ 'Fixed or percentage',
'Fixed or percentage'),
'value': pgettext_lazy(
- 'Sale form label',
+ 'Sale value',
'Value'),
'products': pgettext_lazy(
- 'Sale form label',
+ 'Products in sale',
'Products in sale'),
'categories': pgettext_lazy(
- 'Sale form label',
+ 'Categories',
'Categories')}
def __init__(self, *args, **kwargs):
@@ -61,26 +61,26 @@ class VoucherForm(forms.ModelForm):
exclude = ['limit', 'apply_to', 'product', 'category']
labels = {
'type': pgettext_lazy(
- 'Voucher form label',
+ 'Discount type',
'Discount type'),
'name': pgettext_lazy(
- 'Voucher form label',
+ 'Voucher name',
'Name'),
'code': pgettext_lazy(
- 'Voucher form label',
+ 'Voucher code',
'Code'),
'usage_limit': pgettext_lazy(
- 'Voucher form label',
- 'Limit for using the voucher'),
+ 'Usage limit',
+ 'Usage limit'),
'used': pgettext_lazy(
- 'Voucher form label',
- 'Number of voucher usages'),
+ 'Number of used vouchers',
+ 'Number of used vouchers'),
'start_date': pgettext_lazy(
- 'Voucher form label',
- 'Date voucher starts being valid'),
+ 'Discount start date',
+ 'Discount start date'),
'end_date': pgettext_lazy(
- 'Voucher form label',
- 'Date voucher stops being valid')}
+ 'Discount end date',
+ 'Discount end date')}
def __init__(self, *args, **kwargs):
initial = kwargs.get('initial', {})
@@ -120,10 +120,10 @@ class ShippingVoucherForm(forms.ModelForm):
fields = ['apply_to', 'limit']
labels = {
'apply_to': pgettext_lazy(
- 'Shipping voucher form label',
+ 'Country',
'Country'),
'limit': pgettext_lazy(
- 'Shipping voucher form label',
+ 'Lowest value for order to be able to use the voucher',
'Only if order is over or equal to')}
def save(self, commit=True):
@@ -142,7 +142,7 @@ class ValueVoucherForm(forms.ModelForm):
fields = ['limit']
labels = {
'limit': pgettext_lazy(
- 'Value voucher form label',
+ 'Lowest value for order to be able to use the voucher',
'Only if purchase value is greater than or equal to')}
def save(self, commit=True):
@@ -185,10 +185,10 @@ class ProductVoucherForm(CommonVoucherForm):
fields = ['product', 'apply_to']
labels = {
'apply_to': pgettext_lazy(
- 'Shipping voucher form label',
+ 'Country',
'Country'),
'product': pgettext_lazy(
- 'Shipping voucher form label',
+ 'Product',
'Product')}
def __init__(self, *args, **kwargs):
@@ -204,10 +204,10 @@ class CategoryVoucherForm(CommonVoucherForm):
fields = ['category', 'apply_to']
labels = {
'apply_to': pgettext_lazy(
- 'Category voucher form label',
+ 'Country',
'Country'),
'category': pgettext_lazy(
- 'Category voucher form label',
+ 'Category',
'Category')}
def __init__(self, *args, **kwargs):
diff --git a/saleor/dashboard/group/forms.py b/saleor/dashboard/group/forms.py
index 3161307e0b..138503c5d3 100644
--- a/saleor/dashboard/group/forms.py
+++ b/saleor/dashboard/group/forms.py
@@ -10,9 +10,8 @@ class GroupPermissionsForm(forms.ModelForm):
model = Group
fields = ['name', 'permissions']
labels = {
- 'name': pgettext_lazy('Group permission form label', 'Name'),
- 'permissions': pgettext_lazy(
- 'Group permission form label', 'Permission')}
+ 'name': pgettext_lazy('Group name', 'Name'),
+ 'permissions': pgettext_lazy('Group permission', 'Permission')}
permissions = forms.ModelMultipleChoiceField(
queryset=get_permissions(),
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index 63e43de1ff..4e5315c7f9 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -28,8 +28,8 @@ class OrderNoteForm(forms.ModelForm):
'content': forms.Textarea()}
labels = {
'content': pgettext_lazy(
- 'Order note form label',
- 'Note for the order')}
+ 'Order note',
+ 'Note')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -156,7 +156,7 @@ class ChangeQuantityForm(forms.ModelForm):
fields = ['quantity']
labels = {
'quantity': pgettext_lazy(
- 'Change quantity form label', 'Quantity')}
+ 'Quantity', 'Quantity')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -195,7 +195,7 @@ class ShipGroupForm(forms.ModelForm):
fields = ['tracking_number']
labels = {
'tracking_number': pgettext_lazy(
- 'Shipment group form label', 'Tracking number')}
+ 'Shipment tracking number', 'Tracking number')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -294,7 +294,7 @@ class ChangeStockForm(forms.ModelForm):
fields = ['stock']
labels = {
'stock': pgettext_lazy(
- 'Change stock form label', 'Stock amount')}
+ 'Stock amount', 'Stock amount')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.py
index e4af0682bd..db477c647b 100644
--- a/saleor/dashboard/product/forms.py
+++ b/saleor/dashboard/product/forms.py
@@ -29,11 +29,11 @@ class StockForm(forms.ModelForm):
exclude = ['quantity_allocated', 'variant']
labels = {
'location': pgettext_lazy(
- 'Stock form label', 'Location'),
+ 'Stock location', 'Location'),
'quantity': pgettext_lazy(
- 'Stock form label', 'Quantity'),
+ 'Stock quantity', 'Quantity'),
'cost_price': pgettext_lazy(
- 'Stock form label', 'Cost price')}
+ 'Stock price', 'Cost price')}
def __init__(self, *args, **kwargs):
self.variant = kwargs.pop('variant')
@@ -62,19 +62,19 @@ class ProductClassForm(forms.ModelForm):
exclude = []
labels = {
'name': pgettext_lazy(
- 'Product class form label',
+ 'Product name',
'Name'),
'has_variants': pgettext_lazy(
- 'Product class form label',
+ 'Enable variants',
'Enable variants'),
'variant_attributes': pgettext_lazy(
- 'Product class form label',
+ 'Attributes specific to each variant',
'Attributes specific to each variant'),
'product_attributes': pgettext_lazy(
- 'Product class form label',
+ 'Attributes common to all variants',
'Attributes common to all variants'),
'is_shipping_required': pgettext_lazy(
- 'Product class form label',
+ 'Require shipping',
'Require shipping')}
def clean(self):
@@ -116,16 +116,16 @@ class ProductForm(forms.ModelForm):
model = Product
exclude = ['attributes', 'product_class']
labels = {
- 'name': pgettext_lazy('Product form label', 'Name'),
- 'description': pgettext_lazy('Product form label', 'Description'),
- 'categories': pgettext_lazy('Product form label', 'Categories'),
- 'price': pgettext_lazy('Product form label', 'Price'),
+ 'name': pgettext_lazy('Product name', 'Name'),
+ 'description': pgettext_lazy('Product description', 'Description'),
+ 'categories': pgettext_lazy('Categories', 'Categories'),
+ 'price': pgettext_lazy('Product price', 'Price'),
'available_on': pgettext_lazy(
- 'Product form label', 'Product availabilty'),
- 'updated_at': pgettext_lazy('Product form label', 'Last update'),
- 'is_published': pgettext_lazy('Product form label', 'Published'),
+ 'Availability', 'Availability'),
+ 'updated_at': pgettext_lazy('Last updated', 'Last updated'),
+ 'is_published': pgettext_lazy('Published', 'Published'),
'is_featured': pgettext_lazy(
- 'Product form label', 'Feature this product on homepage')}
+ 'Featured product toggle', 'Feature this product on homepage')}
def __init__(self, *args, **kwargs):
self.product_attributes = []
@@ -173,10 +173,10 @@ class ProductVariantForm(forms.ModelForm):
model = ProductVariant
exclude = ['attributes', 'product', 'images']
labels = {
- 'sku': pgettext_lazy('Product variant form label', 'SKU'),
+ 'sku': pgettext_lazy('SKU', 'SKU'),
'price_override': pgettext_lazy(
- 'Product variant form label', 'Override price'),
- 'name': pgettext_lazy('Product variant form label', 'Name')}
+ 'Override price', 'Override price'),
+ 'name': pgettext_lazy('Product name', 'Name')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -261,9 +261,9 @@ class ProductImageForm(forms.ModelForm):
model = ProductImage
exclude = ('product', 'order')
labels = {
- 'image': pgettext_lazy('Product image form label', 'Image'),
+ 'image': pgettext_lazy('Product image', 'Image'),
'alt': pgettext_lazy(
- 'Product image form label', 'Short description')}
+ 'Short description', 'Short description')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -297,9 +297,9 @@ class ProductAttributeForm(forms.ModelForm):
exclude = []
labels = {
'name': pgettext_lazy(
- 'Product attribute form label', 'Display name'),
+ 'Display name', 'Display name'),
'slug': pgettext_lazy(
- 'Product attribute form label', 'Internal name')}
+ 'Internal name', 'Internal name')}
class StockLocationForm(forms.ModelForm):
@@ -308,7 +308,7 @@ class StockLocationForm(forms.ModelForm):
exclude = []
labels = {
'name': pgettext_lazy(
- 'Stock location form label', 'Stock location')}
+ 'Stock location name', 'Name')}
class AttributeChoiceValueForm(forms.ModelForm):
@@ -318,11 +318,11 @@ class AttributeChoiceValueForm(forms.ModelForm):
widgets = {'attribute': forms.widgets.HiddenInput()}
labels = {
'name': pgettext_lazy(
- 'Attribute choice value form label', 'Display name'),
- 'name': pgettext_lazy(
- 'Attribute choice value form label', 'Attribute'),
+ 'Name', 'Name'),
+ 'attribute': pgettext_lazy(
+ 'Product attribute', 'Attribute'),
'color': pgettext_lazy(
- 'Attribute choice value form label', 'Color')}
+ 'Color', 'Color')}
def save(self, commit=True):
self.instance.slug = slugify(self.instance.name)
@@ -361,7 +361,7 @@ class UploadImageForm(forms.ModelForm):
model = ProductImage
fields = ('image', )
labels = {
- 'image': pgettext_lazy('Upload image form label', 'Image')}
+ 'image': pgettext_lazy('Product image', 'Image')}
def __init__(self, *args, **kwargs):
product = kwargs.pop('product')
diff --git a/saleor/dashboard/shipping/forms.py b/saleor/dashboard/shipping/forms.py
index 2f8880ad9d..1148bb6f82 100644
--- a/saleor/dashboard/shipping/forms.py
+++ b/saleor/dashboard/shipping/forms.py
@@ -11,9 +11,9 @@ class ShippingMethodForm(forms.ModelForm):
exclude = []
labels = {
'name': pgettext_lazy(
- 'Shipping method form label', 'Name'),
+ 'Shipping method name', 'Name'),
'description': pgettext_lazy(
- 'Shipping method form label', 'Description')}
+ 'Description', 'Description')}
class ShippingMethodCountryForm(forms.ModelForm):
@@ -24,8 +24,8 @@ class ShippingMethodCountryForm(forms.ModelForm):
widgets = {'shipping_method': forms.widgets.HiddenInput()}
labels = {
'country_code': pgettext_lazy(
- 'Shipping method country form label', 'Country code'),
+ 'Country code', 'Country code'),
'shipping_method': pgettext_lazy(
- 'Shipping method country form label', 'Shipping method'),
+ 'Shipping method', 'Shipping method'),
'price': pgettext_lazy(
- 'Shipping method country form label', 'Price')}
+ 'Price', 'Price')}
diff --git a/saleor/dashboard/sites/forms.py b/saleor/dashboard/sites/forms.py
index e4c1c25909..beb5ce6596 100644
--- a/saleor/dashboard/sites/forms.py
+++ b/saleor/dashboard/sites/forms.py
@@ -11,9 +11,9 @@ class SiteForm(forms.ModelForm):
exclude = []
labels = {
'domain': pgettext_lazy(
- 'Site form label', 'Domain name'),
+ 'Domain name', 'Domain name'),
'name': pgettext_lazy(
- 'Site form label', 'Display name')}
+ 'Display name', 'Display name')}
class SiteSettingsForm(forms.ModelForm):
@@ -22,9 +22,9 @@ class SiteSettingsForm(forms.ModelForm):
exclude = ['site']
labels = {
'header_text': pgettext_lazy(
- 'Site settings form label', 'Header text'),
+ 'Header text', 'Header text'),
'description': pgettext_lazy(
- 'Site settings form label', 'Site description')}
+ 'Site description', 'Description')}
class AuthorizationKeyForm(forms.ModelForm):
@@ -33,13 +33,13 @@ class AuthorizationKeyForm(forms.ModelForm):
exclude = []
labels = {
'site_settings': pgettext_lazy(
- 'Authorization key form label form label', 'Site settings'),
+ 'Site settings', 'Settings'),
'key': pgettext_lazy(
- 'Authorization key form label form label', 'Key'),
+ 'Key', 'Key'),
'password': pgettext_lazy(
- 'Authorization key form label form label', 'Password'),
+ 'Password', 'Password'),
'name': pgettext_lazy(
- 'Authorization key form label form label', 'Name')}
+ 'Authorization key name', 'Name')}
widgets = {'password': forms.PasswordInput(render_value=True),
'key': forms.TextInput(),
'site_settings': forms.widgets.HiddenInput()}
diff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.py
index 7f2a8859fe..9108129e05 100644
--- a/saleor/dashboard/staff/forms.py
+++ b/saleor/dashboard/staff/forms.py
@@ -18,10 +18,10 @@ class StaffForm(forms.ModelForm):
fields = ['email', 'groups', 'is_staff', 'is_active']
labels = {
'email': pgettext_lazy(
- 'Staff form label', 'Email'),
+ 'Email', 'Email'),
'groups': pgettext_lazy(
- 'Staff form label', 'Groups'),
+ 'Groups', 'Groups'),
'is_active': pgettext_lazy(
- 'Staff form label', 'User is active'),
+ 'User is active', 'User is active'),
'is_staff': pgettext_lazy(
- 'Staff form label', 'Has access to dashboard')}
+ 'User has access to dashboard', 'Has access to dashboard')}
diff --git a/saleor/registration/forms.py b/saleor/registration/forms.py
index 151f5125d7..41dcdb708a 100644
--- a/saleor/registration/forms.py
+++ b/saleor/registration/forms.py
@@ -29,9 +29,9 @@ class SignupForm(forms.ModelForm):
fields = ('email',)
labels = {
'email': pgettext_lazy(
- 'Signup form label', 'Email'),
+ 'Email', 'Email'),
'password': pgettext_lazy(
- 'Signup form label', 'Password')}
+ 'Password', 'Password')}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/saleor/userprofile/i18n.py b/saleor/userprofile/i18n.py
index 9ec9cf9f94..85b988f36e 100644
--- a/saleor/userprofile/i18n.py
+++ b/saleor/userprofile/i18n.py
@@ -61,9 +61,9 @@ class AddressMetaForm(forms.ModelForm):
fields = ['country', 'preview']
labels = {
'country': pgettext_lazy(
- 'Address meta form label', 'Country'),
+ 'Country', 'Country'),
'preview': pgettext_lazy(
- 'Address meta form label', 'Preview')}
+ 'Address preview', 'Preview')}
def clean(self):
data = super().clean()
@@ -95,27 +95,27 @@ class AddressForm(forms.ModelForm):
exclude = []
labels = {
'first_name': pgettext_lazy(
- 'Address form label', 'Given name'),
+ 'First name', 'Given name'),
'last_name': pgettext_lazy(
- 'Address form label', 'Family name'),
+ 'Last name', 'Family name'),
'company_name': pgettext_lazy(
- 'Address form label', 'Company or organization'),
+ 'Company or organization', 'Company or organization'),
'street_address_1': pgettext_lazy(
- 'Address form label', 'Address'),
+ 'First address', 'Address'),
'street_address_2': pgettext_lazy(
- 'Address form label', 'Address'),
+ 'Second address', 'Address'),
'city': pgettext_lazy(
- 'Address form label', 'City'),
+ 'City', 'City'),
'city_area': pgettext_lazy(
- 'Address form label', 'District'),
+ 'City area', 'District'),
'postal_code': pgettext_lazy(
- 'Address form label', 'Postal code'),
+ 'Postal code', 'Postal code'),
'country': pgettext_lazy(
- 'Address form label', 'Country'),
+ 'Country', 'Country'),
'country_area': pgettext_lazy(
- 'Address form label', 'State or province'),
+ 'Country area', 'State or province'),
'phone': pgettext_lazy(
- 'Address form label', 'Phone number')}
+ 'Phone number', 'Phone number')}
phone = PossiblePhoneNumberFormField(
widget=PhonePrefixWidget, required=False)