diff --git a/.idea/evibes.iml b/.idea/evibes.iml index a54ba5f9..5fe1663e 100644 --- a/.idea/evibes.iml +++ b/.idea/evibes.iml @@ -5,6 +5,7 @@ + diff --git a/blog/migrations/0001_initial.py b/blog/migrations/0001_initial.py index d9f6c5ed..231105f3 100644 --- a/blog/migrations/0001_initial.py +++ b/blog/migrations/0001_initial.py @@ -18,56 +18,113 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='PostTag', + name="PostTag", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('tag_name', models.CharField(help_text='internal tag identifier for the post tag', max_length=255, - verbose_name='tag name')), - ('name', models.CharField(help_text='user-friendly name for the post tag', max_length=255, unique=True, - verbose_name='tag display name')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "tag_name", + models.CharField( + help_text="internal tag identifier for the post tag", max_length=255, verbose_name="tag name" + ), + ), + ( + "name", + models.CharField( + help_text="user-friendly name for the post tag", + max_length=255, + unique=True, + verbose_name="tag display name", + ), + ), ], options={ - 'verbose_name': 'post tag', - 'verbose_name_plural': 'post tags', + "verbose_name": "post tag", + "verbose_name_plural": "post tags", }, ), migrations.CreateModel( - name='Post', + name="Post", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('title', models.CharField()), - ('content', markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name='content')), - ('file', models.FileField(blank=True, null=True, upload_to='posts/')), - ('slug', models.SlugField(allow_unicode=True)), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', - to=settings.AUTH_USER_MODEL)), - ('tags', models.ManyToManyField(to='blog.posttag')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("title", models.CharField()), + ("content", markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content")), + ("file", models.FileField(blank=True, null=True, upload_to="posts/")), + ("slug", models.SlugField(allow_unicode=True)), + ( + "author", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="posts", to=settings.AUTH_USER_MODEL + ), + ), + ("tags", models.ManyToManyField(to="blog.posttag")), ], options={ - 'verbose_name': 'post', - 'verbose_name_plural': 'posts', + "verbose_name": "post", + "verbose_name_plural": "posts", }, ), ] diff --git a/blog/migrations/0002_alter_post_slug_alter_post_title.py b/blog/migrations/0002_alter_post_slug_alter_post_title.py index fbaf535f..e247c9ea 100644 --- a/blog/migrations/0002_alter_post_slug_alter_post_title.py +++ b/blog/migrations/0002_alter_post_slug_alter_post_title.py @@ -5,20 +5,21 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('blog', '0001_initial'), + ("blog", "0001_initial"), ] operations = [ migrations.AlterField( - model_name='post', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, blank=True, editable=False, populate_from='title', unique=True), + model_name="post", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, blank=True, editable=False, populate_from="title", unique=True + ), ), migrations.AlterField( - model_name='post', - name='title', - field=models.CharField(help_text='post title', max_length=128, unique=True, verbose_name='title'), + model_name="post", + name="title", + field=models.CharField(help_text="post title", max_length=128, unique=True, verbose_name="title"), ), ] diff --git a/blog/migrations/0003_alter_post_tags.py b/blog/migrations/0003_alter_post_tags.py index 1929216c..c514b15c 100644 --- a/blog/migrations/0003_alter_post_tags.py +++ b/blog/migrations/0003_alter_post_tags.py @@ -4,15 +4,14 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('blog', '0002_alter_post_slug_alter_post_title'), + ("blog", "0002_alter_post_slug_alter_post_title"), ] operations = [ migrations.AlterField( - model_name='post', - name='tags', - field=models.ManyToManyField(blank=True, related_name='posts', to='blog.posttag'), + model_name="post", + name="tags", + field=models.ManyToManyField(blank=True, related_name="posts", to="blog.posttag"), ), ] diff --git a/blog/migrations/0004_post_content_ar_ar_post_content_cs_cz_and_more.py b/blog/migrations/0004_post_content_ar_ar_post_content_cs_cz_and_more.py index db64a94c..4ccfcaec 100644 --- a/blog/migrations/0004_post_content_ar_ar_post_content_cs_cz_and_more.py +++ b/blog/migrations/0004_post_content_ar_ar_post_content_cs_cz_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("blog", "0003_alter_post_tags"), ] @@ -14,128 +13,92 @@ class Migration(migrations.Migration): migrations.AddField( model_name="post", name="content_ar_ar", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_cs_cz", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_da_dk", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_de_de", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_en_gb", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_en_us", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_es_es", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_fr_fr", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_hi_in", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_it_it", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_ja_jp", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_kk_kz", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_nl_nl", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_pl_pl", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_pt_br", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_ro_ro", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_ru_ru", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", name="content_zh_hans", - field=markdown_field.fields.MarkdownField( - blank=True, null=True, verbose_name="content" - ), + field=markdown_field.fields.MarkdownField(blank=True, null=True, verbose_name="content"), ), migrations.AddField( model_name="post", diff --git a/blog/models.py b/blog/models.py index 485d3b8f..a8fd89cd 100644 --- a/blog/models.py +++ b/blog/models.py @@ -31,10 +31,8 @@ class Post(NiceModel): is_publicly_visible = True - author: ForeignKey = ForeignKey( - to="vibes_auth.User", on_delete=CASCADE, blank=False, null=False, related_name="posts" - ) - title: CharField = CharField( + author = ForeignKey(to="vibes_auth.User", on_delete=CASCADE, blank=False, null=False, related_name="posts") + title = CharField( unique=True, max_length=128, blank=False, null=False, help_text=_("post title"), verbose_name=_("title") ) content: MarkdownField = MarkdownField( @@ -74,9 +72,9 @@ class Post(NiceModel): blank=True, null=True, ) - file: FileField = FileField(upload_to="posts/", blank=True, null=True) - slug: AutoSlugField = AutoSlugField(populate_from="title", allow_unicode=True, unique=True, editable=False) - tags: ManyToManyField = ManyToManyField(to="blog.PostTag", blank=True, related_name="posts") + file = FileField(upload_to="posts/", blank=True, null=True) + slug = AutoSlugField(populate_from="title", allow_unicode=True, unique=True, editable=False) + tags = ManyToManyField(to="blog.PostTag", blank=True, related_name="posts") def __str__(self): return f"{self.title} | {self.author.first_name} {self.author.last_name}" @@ -115,15 +113,16 @@ class PostTag(NiceModel): """ is_publicly_visible = True + posts: "Post" - tag_name: CharField = CharField( + tag_name = CharField( blank=False, null=False, max_length=255, help_text=_("internal tag identifier for the post tag"), verbose_name=_("tag name"), ) - name: CharField = CharField( + name = CharField( max_length=255, help_text=_("user-friendly name for the post tag"), verbose_name=_("tag display name"), diff --git a/core/abstract.py b/core/abstract.py index 4a742d35..65f631e8 100644 --- a/core/abstract.py +++ b/core/abstract.py @@ -1,5 +1,4 @@ import uuid -from datetime import datetime from django.db.models import BooleanField, Model, UUIDField from django.utils.translation import gettext_lazy as _ @@ -7,25 +6,21 @@ from django_extensions.db.fields import CreationDateTimeField, ModificationDateT class NiceModel(Model): - id = None - uuid: uuid = UUIDField( # type: ignore + id: None = None + uuid = UUIDField( verbose_name=_("unique id"), help_text=_("unique id is used to surely identify any database object"), primary_key=True, default=uuid.uuid4, editable=False, ) - is_active: bool = BooleanField( # type: ignore + is_active = BooleanField( default=True, verbose_name=_("is active"), help_text=_("if set to false, this object can't be seen by users without needed permission"), ) - created: datetime = CreationDateTimeField( # type: ignore - _("created"), help_text=_("when the object first appeared on the database") - ) - modified: datetime = ModificationDateTimeField( # type: ignore - _("modified"), help_text=_("when the object was last modified") - ) + created = CreationDateTimeField(_("created"), help_text=_("when the object first appeared on the database")) + modified = ModificationDateTimeField(_("modified"), help_text=_("when the object was last modified")) def save(self, **kwargs): self.update_modified = kwargs.pop("update_modified", getattr(self, "update_modified", True)) diff --git a/core/admin.py b/core/admin.py index 22c50b16..7e5ddf32 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,4 +1,5 @@ from contextlib import suppress +from typing import ClassVar, Type from constance.admin import Config from constance.admin import ConstanceAdmin as BaseConstanceAdmin @@ -38,7 +39,7 @@ from evibes.settings import CONSTANCE_CONFIG class FieldsetsMixin: general_fields: list = [] relation_fields: list = [] - model: Model + model: ClassVar[Type[Model]] def get_fieldsets(self, request, obj=None): if request: @@ -172,7 +173,7 @@ class CategoryChildrenInline(TabularInline): @register(AttributeGroup) class AttributeGroupAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = AttributeGroup # type: ignore + model = AttributeGroup list_display = ("name", "modified") search_fields = ("uuid", "name") readonly_fields = ("uuid", "modified", "created") @@ -183,7 +184,7 @@ class AttributeGroupAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Attribute) class AttributeAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Attribute # type: ignore + model = Attribute list_display = ("name", "group", "value_type", "modified") list_filter = ("value_type", "group", "is_active") search_fields = ("uuid", "name", "group__name") @@ -196,7 +197,7 @@ class AttributeAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(AttributeValue) class AttributeValueAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = AttributeValue # type: ignore + model = AttributeValue list_display = ("attribute", "value", "modified") list_filter = ("attribute__group", "is_active") search_fields = ("uuid", "value", "attribute__name") @@ -209,7 +210,7 @@ class AttributeValueAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Category) class CategoryAdmin(FieldsetsMixin, ActivationActionsMixin, DraggableMPTTAdmin): - model = Category # type: ignore + model = Category list_display = ("indented_title", "parent", "is_active", "modified") # noinspection PyUnresolvedReferences list_filter = ("is_active", "level", "created", "modified") @@ -224,7 +225,7 @@ class CategoryAdmin(FieldsetsMixin, ActivationActionsMixin, DraggableMPTTAdmin): @register(Brand) class BrandAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Brand # type: ignore + model = Brand list_display = ("name",) list_filter = ("categories", "is_active") search_fields = ("uuid", "name", "categories__name") @@ -236,7 +237,7 @@ class BrandAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Product) class ProductAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Product # type: ignore + model = Product list_display = ( "name", "partnumber", @@ -275,7 +276,7 @@ class ProductAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(ProductTag) class ProductTagAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = ProductTag # type: ignore + model = ProductTag list_display = ("tag_name",) search_fields = ("tag_name",) readonly_fields = ("uuid", "modified", "created") @@ -286,7 +287,7 @@ class ProductTagAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(CategoryTag) class CategoryTagAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = CategoryTag # type: ignore + model = CategoryTag list_display = ("tag_name",) search_fields = ("tag_name",) readonly_fields = ("uuid", "modified", "created") @@ -297,7 +298,7 @@ class CategoryTagAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Vendor) class VendorAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Vendor # type: ignore + model = Vendor list_display = ("name", "markup_percent", "modified") list_filter = ("markup_percent", "is_active") search_fields = ("name",) @@ -310,7 +311,7 @@ class VendorAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Feedback) class FeedbackAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Feedback # type: ignore + model = Feedback list_display = ("order_product", "rating", "comment", "modified") list_filter = ("rating", "is_active") search_fields = ("order_product__product__name", "comment") @@ -322,7 +323,7 @@ class FeedbackAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Order) class OrderAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Order # type: ignore + model = Order list_display = ( "human_readable_id", "user", @@ -350,7 +351,7 @@ class OrderAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(OrderProduct) class OrderProductAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = OrderProduct # type: ignore + model = OrderProduct list_display = ("order", "product", "quantity", "buy_price", "status", "modified") list_filter = ("status",) search_fields = ("order__user__email", "product__name") @@ -363,7 +364,7 @@ class OrderProductAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(PromoCode) class PromoCodeAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = PromoCode # type: ignore + model = PromoCode list_display = ( "code", "discount_percent", @@ -391,7 +392,7 @@ class PromoCodeAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Promotion) class PromotionAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Promotion # type: ignore + model = Promotion list_display = ("name", "discount_percent", "modified") search_fields = ("name",) readonly_fields = ("uuid", "modified", "created") @@ -403,7 +404,7 @@ class PromotionAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Stock) class StockAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Stock # type: ignore + model = Stock list_display = ("product", "vendor", "sku", "quantity", "price", "modified") list_filter = ("vendor", "quantity") search_fields = ("product__name", "vendor__name", "sku") @@ -423,7 +424,7 @@ class StockAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Wishlist) class WishlistAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = Wishlist # type: ignore + model = Wishlist list_display = ("user", "modified") search_fields = ("user__email",) readonly_fields = ("uuid", "modified", "created") @@ -434,7 +435,7 @@ class WishlistAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(ProductImage) class ProductImageAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): - model = ProductImage # type: ignore + model = ProductImage list_display = ("alt", "product", "priority", "modified") list_filter = ("priority",) search_fields = ("alt", "product__name") @@ -447,7 +448,7 @@ class ProductImageAdmin(FieldsetsMixin, ActivationActionsMixin, ModelAdmin): @register(Address) class AddressAdmin(FieldsetsMixin, GISModelAdmin): - model = Address # type: ignore + model = Address list_display = ("street", "city", "region", "country", "user") list_filter = ("country", "region") search_fields = ("street", "city", "postal_code", "user__email") @@ -507,8 +508,10 @@ class ConstanceConfig: _meta = Meta() -site.unregister([Config]) # type: ignore -site.register([ConstanceConfig], BaseConstanceAdmin) # type: ignore -site.site_title = CONSTANCE_CONFIG["PROJECT_NAME"][0] # type: ignore +# noinspection PyTypeChecker +site.unregister([Config]) +# noinspection PyTypeChecker +site.register([ConstanceConfig], BaseConstanceAdmin) +site.site_title = CONSTANCE_CONFIG["PROJECT_NAME"][0] site.site_header = "eVibes" -site.index_title = CONSTANCE_CONFIG["PROJECT_NAME"][0] # type: ignore +site.index_title = CONSTANCE_CONFIG["PROJECT_NAME"][0] diff --git a/core/elasticsearch/__init__.py b/core/elasticsearch/__init__.py index 041150b0..cf6ebbfd 100644 --- a/core/elasticsearch/__init__.py +++ b/core/elasticsearch/__init__.py @@ -185,8 +185,8 @@ def process_query(query: str = "", request: Request | None = None) -> dict[str, results[idx].append(hit_result) return results - except NotFoundError: - raise Http404 + except NotFoundError as nfe: + raise Http404 from nfe LANGUAGE_ANALYZER_MAP = { diff --git a/core/graphene/mutations.py b/core/graphene/mutations.py index c0ecc194..2ae29805 100644 --- a/core/graphene/mutations.py +++ b/core/graphene/mutations.py @@ -96,8 +96,8 @@ class AddOrderProduct(BaseMutation): order = order.add_product(product_uuid=product_uuid, attributes=format_attributes(attributes)) return AddOrderProduct(order=order) - except Order.DoesNotExist: - raise Http404(_(f"order {order_uuid} not found")) + except Order.DoesNotExist as dne: + raise Http404(_(f"order {order_uuid} not found")) from dne class RemoveOrderProduct(BaseMutation): @@ -122,8 +122,8 @@ class RemoveOrderProduct(BaseMutation): order = order.remove_product(product_uuid=product_uuid, attributes=format_attributes(attributes)) return AddOrderProduct(order=order) - except Order.DoesNotExist: - raise Http404(_(f"order {order_uuid} not found")) + except Order.DoesNotExist as dne: + raise Http404(_(f"order {order_uuid} not found")) from dne class RemoveAllOrderProducts(BaseMutation): @@ -224,8 +224,8 @@ class BuyOrder(BaseMutation): case _: raise TypeError(_(f"wrong type came from order.buy() method: {type(instance)!s}")) - except Order.DoesNotExist: - raise Http404(_(f"order {order_uuid} not found")) + except Order.DoesNotExist as dne: + raise Http404(_(f"order {order_uuid} not found")) from dne class BulkOrderAction(BaseMutation): @@ -271,8 +271,8 @@ class BulkOrderAction(BaseMutation): return BulkOrderAction(order=order) - except Order.DoesNotExist: - raise Http404(_(f"order {order_uuid} not found")) + except Order.DoesNotExist as dne: + raise Http404(_(f"order {order_uuid} not found")) from dne class BuyUnregisteredOrder(BaseMutation): @@ -344,8 +344,8 @@ class AddWishlistProduct(BaseMutation): return AddWishlistProduct(wishlist=wishlist) - except Wishlist.DoesNotExist: - raise Http404(_(f"wishlist {wishlist_uuid} not found")) + except Wishlist.DoesNotExist as dne: + raise Http404(_(f"wishlist {wishlist_uuid} not found")) from dne class RemoveWishlistProduct(BaseMutation): @@ -371,8 +371,8 @@ class RemoveWishlistProduct(BaseMutation): return RemoveWishlistProduct(wishlist=wishlist) - except Wishlist.DoesNotExist: - raise Http404(_(f"wishlist {wishlist_uuid} not found")) + except Wishlist.DoesNotExist as dne: + raise Http404(_(f"wishlist {wishlist_uuid} not found")) from dne class RemoveAllWishlistProducts(BaseMutation): @@ -398,8 +398,8 @@ class RemoveAllWishlistProducts(BaseMutation): return RemoveAllWishlistProducts(wishlist=wishlist) - except Wishlist.DoesNotExist: - raise Http404(_(f"wishlist {wishlist_uuid} not found")) + except Wishlist.DoesNotExist as dne: + raise Http404(_(f"wishlist {wishlist_uuid} not found")) from dne class BuyWishlist(BaseMutation): @@ -441,8 +441,8 @@ class BuyWishlist(BaseMutation): case _: raise TypeError(_(f"wrong type came from order.buy() method: {type(instance)!s}")) - except Wishlist.DoesNotExist: - raise Http404(_(f"wishlist {wishlist_uuid} not found")) + except Wishlist.DoesNotExist as dne: + raise Http404(_(f"wishlist {wishlist_uuid} not found")) from dne class BuyProduct(BaseMutation): @@ -575,9 +575,9 @@ class DeleteAddress(BaseMutation): raise PermissionDenied(permission_denied_message) - except Address.DoesNotExist: + except Address.DoesNotExist as dne: name = "Address" - raise Http404(_(f"{name} does not exist: {uuid}")) + raise Http404(_(f"{name} does not exist: {uuid}")) from dne class AutocompleteAddress(BaseMutation): diff --git a/core/graphene/object_types.py b/core/graphene/object_types.py index 2d15bff5..75a4c964 100644 --- a/core/graphene/object_types.py +++ b/core/graphene/object_types.py @@ -443,7 +443,7 @@ class PromoCodeType(DjangoObjectType): description = _("promocodes") def resolve_discount(self: PromoCode, _info) -> float: - return float(self.discount_percent) if self.discount_percent else float(self.discount_amount) + return float(self.discount_percent) if self.discount_percent else float(self.discount_amount) # type: ignore [arg-type] def resolve_discount_type(self: PromoCode, _info) -> str: return "percent" if self.discount_percent else "amount" diff --git a/core/management/commands/check_translated.py b/core/management/commands/check_translated.py index e0d93830..b7a4683a 100644 --- a/core/management/commands/check_translated.py +++ b/core/management/commands/check_translated.py @@ -39,7 +39,7 @@ def load_po_sanitized(path: str) -> polib.POFile: with open(path, encoding="utf-8") as f: text = f.read() except OSError as e: - raise CommandError(f"{path}: cannot read file ({e})") + raise CommandError(f"{path}: cannot read file ({e})") from e # fix fuzzy flags and empty header entries text = re.sub(r"^#,(?!\s)", "#, ", text, flags=re.MULTILINE) parts = text.split("\n\n", 1) @@ -54,7 +54,7 @@ def load_po_sanitized(path: str) -> polib.POFile: tmp.close() return polib.pofile(tmp.name) except Exception as e: - raise CommandError(f"{path}: syntax error after sanitization ({e})") + raise CommandError(f"{path}: syntax error after sanitization ({e})") from e finally: with contextlib.suppress(OSError): os.unlink(tmp.name) @@ -97,7 +97,8 @@ class Command(BaseCommand): root_path: str = options.get("root_path") or "/app/" configs = list(apps.get_app_configs()) - configs.append(RootDirectory()) + # noinspection PyTypeChecker + configs.append(RootDirectory()) # type: ignore [arg-type] for app_conf in configs: if app_conf.label not in apps_to_scan: diff --git a/core/management/commands/deepl_translate.py b/core/management/commands/deepl_translate.py index d837715a..85b4ef0c 100644 --- a/core/management/commands/deepl_translate.py +++ b/core/management/commands/deepl_translate.py @@ -138,7 +138,8 @@ class Command(BaseCommand): self.stdout.write(self.style.MIGRATE_HEADING(f"→ Translating into {target_lang}")) configs = list(apps.get_app_configs()) - configs.append(RootDirectory()) + # noinspection PyTypeChecker + configs.append(RootDirectory()) # type: ignore [arg-type] for app_conf in configs: if app_conf.label not in target_apps: @@ -212,8 +213,8 @@ class Command(BaseCommand): protected = [] maps: list[list[str]] = [] - for e in to_trans: - txt = source_map[e.msgid] + for entry in to_trans: + txt = source_map[entry.msgid] p_txt, p_map = placeholderize(txt) protected.append(p_txt) maps.append(p_map) @@ -227,14 +228,14 @@ class Command(BaseCommand): resp.raise_for_status() result = resp.json() except Exception as exc: - raise CommandError(f"DeepL error: {exc} – {resp.text}") + raise CommandError(f"DeepL error: {exc} – {resp.text}") from exc trans = result.get("translations", []) if len(trans) != len(to_trans): raise CommandError(f"Got {len(trans)} translations, expected {len(to_trans)}") - for e, obj, pmap in zip(to_trans, trans, maps, strict=True): - e.msgstr = deplaceholderize(obj["text"], pmap) + for entry, obj, pmap in zip(to_trans, trans, maps, strict=True): + entry.msgstr = deplaceholderize(obj["text"], pmap) new_po.save(tgt_path) self.stdout.write(self.style.SUCCESS(f"Saved {tgt_path}")) diff --git a/core/management/commands/fix_prices.py b/core/management/commands/fix_prices.py index 612d88ab..e2f1726a 100644 --- a/core/management/commands/fix_prices.py +++ b/core/management/commands/fix_prices.py @@ -15,7 +15,7 @@ class Command(BaseCommand): for product in Product.objects.filter(stocks__isnull=False): for stock in product.stocks.all(): try: - stock.price = AbstractVendor.round_price_marketologically(stock.price) # type: ignore + stock.price = AbstractVendor.round_price_marketologically(stock.price) stock.save() except Exception as e: self.stdout.write(self.style.WARNING(f"Couldn't fix price on {stock.uuid}")) diff --git a/core/management/commands/translate_fields.py b/core/management/commands/translate_fields.py index d431ec81..53538b4f 100644 --- a/core/management/commands/translate_fields.py +++ b/core/management/commands/translate_fields.py @@ -61,16 +61,16 @@ class Command(BaseCommand): try: module_path, model_name, field_name = target.rsplit(".", 2) - except ValueError: + except ValueError as e: raise CommandError( "Invalid target format. Use app.module.Model.field, e.g. core.models.Product.description" - ) + ) from e try: module = importlib.import_module(module_path) model = getattr(module, model_name) except (ImportError, AttributeError) as e: - raise CommandError(f"Could not import model '{model_name}' from '{module_path}': {e}") + raise CommandError(f"Could not import model '{model_name}' from '{module_path}': {e}") from e dest_suffix = lang.replace("-", "_") dest_field = f"{field_name}_{dest_suffix}" diff --git a/core/managers.py b/core/managers.py index 283b1ee4..7337fdd4 100644 --- a/core/managers.py +++ b/core/managers.py @@ -9,20 +9,20 @@ logger = logging.getLogger("evibes") class AddressManager(models.Manager): - def create(self, raw_data: str, **kwargs): # type: ignore - if not raw_data: + def create(self, **kwargs): + if not kwargs.get("raw_data"): raise ValueError("'raw_data' (address string) must be provided.") - params: dict[str, str | int] = { + params: dict[str, str | int] = { # type: ignore [annotation-unchecked] "format": "json", "addressdetails": 1, - "q": raw_data, + "q": kwargs.get("raw_data"), } resp = requests.get(config.NOMINATIM_URL.rstrip("/") + "/search", params=params) resp.raise_for_status() results = resp.json() if not results: - raise ValueError(f"No geocoding result for address: {raw_data}") + raise ValueError(f"No geocoding result for address: {kwargs.get('raw_data')}") data = results[0] addr = data.get("address", {}) @@ -51,7 +51,7 @@ class AddressManager(models.Manager): address_line_2 = "" return super().get_or_create( - raw_data=raw_data, + raw_data=kwargs.get("raw_data"), address_line=f"{address_line_1}, {address_line_2}", street=street, district=district, diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index 657d41f1..ddfced4c 100644 --- a/core/migrations/0001_initial.py +++ b/core/migrations/0001_initial.py @@ -17,980 +17,2693 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Feedback', + name="Feedback", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('comment', models.TextField(blank=True, - help_text='user-provided comments about their experience with the product', - null=True, verbose_name='feedback comments')), - ('rating', models.FloatField(blank=True, help_text='user-assigned rating for the product', null=True, - validators=[django.core.validators.MinValueValidator(0), - django.core.validators.MaxValueValidator(10)], - verbose_name='product rating')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "comment", + models.TextField( + blank=True, + help_text="user-provided comments about their experience with the product", + null=True, + verbose_name="feedback comments", + ), + ), + ( + "rating", + models.FloatField( + blank=True, + help_text="user-assigned rating for the product", + null=True, + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(10), + ], + verbose_name="product rating", + ), + ), ], options={ - 'verbose_name': 'feedback', - 'verbose_name_plural': 'feedbacks', + "verbose_name": "feedback", + "verbose_name_plural": "feedbacks", }, ), migrations.CreateModel( - name='OrderProduct', + name="OrderProduct", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('buy_price', models.FloatField(blank=True, - help_text='the price paid by the customer for this product at purchase time', - null=True, verbose_name='purchase price at order time')), - ('comments', - models.TextField(blank=True, help_text='internal comments for admins about this ordered product', - null=True, verbose_name='internal comments')), - ('notifications', - models.JSONField(blank=True, help_text='json structure of notifications to display to users', - null=True, verbose_name='user notifications')), - ('attributes', - models.JSONField(blank=True, help_text="json representation of this item's attributes", null=True, - verbose_name='ordered product attributes')), - ('quantity', - models.PositiveIntegerField(default=1, help_text='quantity of this specific product in the order', - verbose_name='product quantity')), - ('status', models.CharField( - choices=[('FINISHED', 'finished'), ('DELIVERING', 'delivering'), ('DELIVERED', 'delivered'), - ('CANCELED', 'canceled'), ('FAILED', 'failed'), ('PENDING', 'pending'), - ('ACCEPTED', 'accepted'), ('RETURNED', 'money returned')], default='PENDING', - help_text='current status of this product in the order', max_length=128, - verbose_name='product line status')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "buy_price", + models.FloatField( + blank=True, + help_text="the price paid by the customer for this product at purchase time", + null=True, + verbose_name="purchase price at order time", + ), + ), + ( + "comments", + models.TextField( + blank=True, + help_text="internal comments for admins about this ordered product", + null=True, + verbose_name="internal comments", + ), + ), + ( + "notifications", + models.JSONField( + blank=True, + help_text="json structure of notifications to display to users", + null=True, + verbose_name="user notifications", + ), + ), + ( + "attributes", + models.JSONField( + blank=True, + help_text="json representation of this item's attributes", + null=True, + verbose_name="ordered product attributes", + ), + ), + ( + "quantity", + models.PositiveIntegerField( + default=1, + help_text="quantity of this specific product in the order", + verbose_name="product quantity", + ), + ), + ( + "status", + models.CharField( + choices=[ + ("FINISHED", "finished"), + ("DELIVERING", "delivering"), + ("DELIVERED", "delivered"), + ("CANCELED", "canceled"), + ("FAILED", "failed"), + ("PENDING", "pending"), + ("ACCEPTED", "accepted"), + ("RETURNED", "money returned"), + ], + default="PENDING", + help_text="current status of this product in the order", + max_length=128, + verbose_name="product line status", + ), + ), ], options={ - 'verbose_name': 'order product', - 'verbose_name_plural': 'order products', + "verbose_name": "order product", + "verbose_name_plural": "order products", }, ), migrations.CreateModel( - name='Product', + name="Product", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('is_digital', - models.BooleanField(default=False, help_text='indicates whether this product is digitally delivered', - verbose_name='is product digital')), - ('name', models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - verbose_name='product name')), - ('name_en_GB', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_ar_AR', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_cs_CZ', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_da_DK', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_de_DE', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_en_US', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_es_ES', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_fr_FR', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_hi_IN', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_it_IT', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_ja_JP', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_kk_KZ', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_nl_NL', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_pl_PL', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_pt_BR', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_ro_RO', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_ru_RU', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('name_zh_hans', - models.CharField(help_text='provide a clear identifying name for the product', max_length=255, - null=True, verbose_name='product name')), - ('description', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_en_GB', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_ar_AR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_cs_CZ', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_da_DK', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_de_DE', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_en_US', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_es_ES', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_fr_FR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_hi_IN', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_it_IT', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_ja_JP', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_kk_KZ', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_nl_NL', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_pl_PL', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_pt_BR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_ro_RO', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_ru_RU', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), - ('description_zh_hans', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='product description')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "is_digital", + models.BooleanField( + default=False, + help_text="indicates whether this product is digitally delivered", + verbose_name="is product digital", + ), + ), + ( + "name", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + verbose_name="product name", + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_en_US", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), + ), + ( + "description", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_en_GB", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_ar_AR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_cs_CZ", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_da_DK", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_de_DE", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_en_US", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_es_ES", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_fr_FR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_hi_IN", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_it_IT", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_ja_JP", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_kk_KZ", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_nl_NL", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_pl_PL", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_pt_BR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_ro_RO", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_ru_RU", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), + ( + "description_zh_hans", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="product description", + ), + ), ], options={ - 'verbose_name': 'product', - 'verbose_name_plural': 'products', + "verbose_name": "product", + "verbose_name_plural": "products", }, ), migrations.CreateModel( - name='ProductImage', + name="ProductImage", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('alt', - models.CharField(help_text='provide alternative text for the image for accessibility', max_length=255, - verbose_name='image alt text')), - ('image', models.ImageField(help_text='upload the image file for this product', - upload_to=core.utils.get_product_uuid_as_path, - verbose_name='product image')), - ('priority', - models.IntegerField(default=1, help_text='determines the order in which images are displayed', - validators=[django.core.validators.MinValueValidator(1)], - verbose_name='display priority')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "alt", + models.CharField( + help_text="provide alternative text for the image for accessibility", + max_length=255, + verbose_name="image alt text", + ), + ), + ( + "image", + models.ImageField( + help_text="upload the image file for this product", + upload_to=core.utils.get_product_uuid_as_path, + verbose_name="product image", + ), + ), + ( + "priority", + models.IntegerField( + default=1, + help_text="determines the order in which images are displayed", + validators=[django.core.validators.MinValueValidator(1)], + verbose_name="display priority", + ), + ), ], options={ - 'verbose_name': 'product image', - 'verbose_name_plural': 'product images', - 'ordering': ('priority',), + "verbose_name": "product image", + "verbose_name_plural": "product images", + "ordering": ("priority",), }, ), migrations.CreateModel( - name='ProductTag', + name="ProductTag", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('tag_name', models.CharField(help_text='internal tag identifier for the product tag', max_length=255, - verbose_name='tag name')), - ('name', models.CharField(help_text='user-friendly name for the product tag', max_length=255, - verbose_name='tag display name')), - ('name_en_GB', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_ar_AR', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_cs_CZ', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_da_DK', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_de_DE', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_en_US', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_es_ES', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_fr_FR', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_hi_IN', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_it_IT', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_ja_JP', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_kk_KZ', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_nl_NL', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_pl_PL', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_pt_BR', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_ro_RO', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_ru_RU', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), - ('name_zh_hans', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - verbose_name='tag display name')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "tag_name", + models.CharField( + help_text="internal tag identifier for the product tag", max_length=255, verbose_name="tag name" + ), + ), + ( + "name", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + verbose_name="tag display name", + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_en_US", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + verbose_name="tag display name", + ), + ), ], options={ - 'verbose_name': 'product tag', - 'verbose_name_plural': 'product tags', + "verbose_name": "product tag", + "verbose_name_plural": "product tags", }, ), migrations.CreateModel( - name='PromoCode', + name="PromoCode", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('code', models.CharField(default=core.utils.get_random_code, - help_text='unique code used by a user to redeem a discount', max_length=20, - unique=True, verbose_name='promo code identifier')), - ('discount_amount', models.DecimalField(blank=True, decimal_places=2, - help_text='fixed discount amount applied if percent is not used', - max_digits=10, null=True, - verbose_name='fixed discount amount')), - ('discount_percent', - models.IntegerField(blank=True, help_text='percentage discount applied if fixed amount is not used', - null=True, validators=[django.core.validators.MinValueValidator(1), - django.core.validators.MaxValueValidator(100)], - verbose_name='percentage discount')), - ('end_time', - models.DateTimeField(blank=True, help_text='timestamp when the promocode expires', null=True, - verbose_name='end validity time')), - ('start_time', - models.DateTimeField(blank=True, help_text='timestamp from which this promocode is valid', null=True, - verbose_name='start validity time')), - ('used_on', models.DateTimeField(blank=True, - help_text='timestamp when the promocode was used, blank if not used yet', - null=True, verbose_name='usage timestamp')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "code", + models.CharField( + default=core.utils.get_random_code, + help_text="unique code used by a user to redeem a discount", + max_length=20, + unique=True, + verbose_name="promo code identifier", + ), + ), + ( + "discount_amount", + models.DecimalField( + blank=True, + decimal_places=2, + help_text="fixed discount amount applied if percent is not used", + max_digits=10, + null=True, + verbose_name="fixed discount amount", + ), + ), + ( + "discount_percent", + models.IntegerField( + blank=True, + help_text="percentage discount applied if fixed amount is not used", + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + verbose_name="percentage discount", + ), + ), + ( + "end_time", + models.DateTimeField( + blank=True, + help_text="timestamp when the promocode expires", + null=True, + verbose_name="end validity time", + ), + ), + ( + "start_time", + models.DateTimeField( + blank=True, + help_text="timestamp from which this promocode is valid", + null=True, + verbose_name="start validity time", + ), + ), + ( + "used_on", + models.DateTimeField( + blank=True, + help_text="timestamp when the promocode was used, blank if not used yet", + null=True, + verbose_name="usage timestamp", + ), + ), ], options={ - 'verbose_name': 'promo code', - 'verbose_name_plural': 'promo codes', + "verbose_name": "promo code", + "verbose_name_plural": "promo codes", }, ), migrations.CreateModel( - name='Promotion', + name="Promotion", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('discount_percent', models.IntegerField(help_text='percentage discount for the selected products', - validators=[django.core.validators.MinValueValidator(1), - django.core.validators.MaxValueValidator(100)], - verbose_name='discount percentage')), - ('name', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, unique=True, - verbose_name='promotion name')), - ('name_en_GB', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_ar_AR', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_cs_CZ', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_da_DK', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_de_DE', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_en_US', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_es_ES', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_fr_FR', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_hi_IN', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_it_IT', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_ja_JP', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_kk_KZ', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_nl_NL', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_pl_PL', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_pt_BR', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_ro_RO', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_ru_RU', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('name_zh_hans', - models.CharField(help_text='provide a unique name for this promotion', max_length=256, null=True, - unique=True, verbose_name='promotion name')), - ('description', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_en_GB', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_ar_AR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_cs_CZ', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_da_DK', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_de_DE', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_en_US', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_es_ES', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_fr_FR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_hi_IN', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_it_IT', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_ja_JP', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_kk_KZ', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_nl_NL', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_pl_PL', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_pt_BR', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_ro_RO', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_ru_RU', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), - ('description_zh_hans', - models.TextField(blank=True, help_text='add a detailed description of the product', null=True, - verbose_name='promotion description')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "discount_percent", + models.IntegerField( + help_text="percentage discount for the selected products", + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + verbose_name="discount percentage", + ), + ), + ( + "name", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_en_US", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="provide a unique name for this promotion", + max_length=256, + null=True, + unique=True, + verbose_name="promotion name", + ), + ), + ( + "description", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_en_GB", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_ar_AR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_cs_CZ", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_da_DK", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_de_DE", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_en_US", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_es_ES", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_fr_FR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_hi_IN", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_it_IT", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_ja_JP", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_kk_KZ", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_nl_NL", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_pl_PL", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_pt_BR", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_ro_RO", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_ru_RU", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), + ( + "description_zh_hans", + models.TextField( + blank=True, + help_text="add a detailed description of the product", + null=True, + verbose_name="promotion description", + ), + ), ], options={ - 'verbose_name': 'promotion', - 'verbose_name_plural': 'promotions', + "verbose_name": "promotion", + "verbose_name_plural": "promotions", }, ), migrations.CreateModel( - name='Stock', + name="Stock", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('price', models.FloatField(default=0.0, help_text='final price to the customer after markups', - verbose_name='selling price')), - ('purchase_price', - models.FloatField(default=0.0, help_text='the price paid to the vendor for this product', - verbose_name='vendor purchase price')), - ('quantity', models.IntegerField(default=0, help_text='available quantity of the product in stock', - verbose_name='quantity in stock')), - ('sku', models.CharField(help_text='vendor-assigned SKU for identifying the product', max_length=255, - verbose_name='vendor sku')), - ('digital_asset', models.FileField(blank=True, default=None, - help_text='digital file associated with this stock if applicable', - null=True, upload_to='downloadables/', verbose_name='digital file')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "price", + models.FloatField( + default=0.0, help_text="final price to the customer after markups", verbose_name="selling price" + ), + ), + ( + "purchase_price", + models.FloatField( + default=0.0, + help_text="the price paid to the vendor for this product", + verbose_name="vendor purchase price", + ), + ), + ( + "quantity", + models.IntegerField( + default=0, + help_text="available quantity of the product in stock", + verbose_name="quantity in stock", + ), + ), + ( + "sku", + models.CharField( + help_text="vendor-assigned SKU for identifying the product", + max_length=255, + verbose_name="vendor sku", + ), + ), + ( + "digital_asset", + models.FileField( + blank=True, + default=None, + help_text="digital file associated with this stock if applicable", + null=True, + upload_to="downloadables/", + verbose_name="digital file", + ), + ), ], options={ - 'verbose_name': 'stock', - 'verbose_name_plural': 'stock entries', + "verbose_name": "stock", + "verbose_name_plural": "stock entries", }, ), migrations.CreateModel( - name='Vendor', + name="Vendor", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('authentication', models.JSONField(blank=True, - help_text='stores credentials and endpoints required for vendor communication', - null=True, verbose_name='authentication info')), - ('markup_percent', - models.IntegerField(default=0, help_text='define the markup for products retrieved from this vendor', - validators=[django.core.validators.MinValueValidator(0), - django.core.validators.MaxValueValidator(100)], - verbose_name='vendor markup percentage')), - ('name', models.CharField(help_text='name of this vendor', max_length=255, verbose_name='vendor name')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "authentication", + models.JSONField( + blank=True, + help_text="stores credentials and endpoints required for vendor communication", + null=True, + verbose_name="authentication info", + ), + ), + ( + "markup_percent", + models.IntegerField( + default=0, + help_text="define the markup for products retrieved from this vendor", + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(100), + ], + verbose_name="vendor markup percentage", + ), + ), + ("name", models.CharField(help_text="name of this vendor", max_length=255, verbose_name="vendor name")), ], options={ - 'verbose_name': 'vendor', - 'verbose_name_plural': 'vendors', + "verbose_name": "vendor", + "verbose_name_plural": "vendors", }, ), migrations.CreateModel( - name='Wishlist', + name="Wishlist", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), ], options={ - 'verbose_name': 'wishlist', - 'verbose_name_plural': 'wishlists', + "verbose_name": "wishlist", + "verbose_name_plural": "wishlists", }, ), migrations.CreateModel( - name='AttributeGroup', + name="AttributeGroup", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('name', models.CharField(help_text="attribute group's name", max_length=255, - verbose_name="attribute group's name")), - ('name_en_GB', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_ar_AR', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_cs_CZ', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_da_DK', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_de_DE', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_en_US', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_es_ES', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_fr_FR', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_hi_IN', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_it_IT', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_ja_JP', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_kk_KZ', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_nl_NL', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_pl_PL', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_pt_BR', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_ro_RO', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_ru_RU', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('name_zh_hans', models.CharField(help_text="attribute group's name", max_length=255, null=True, - verbose_name="attribute group's name")), - ('parent', models.ForeignKey(blank=True, help_text='parent of this group', null=True, - on_delete=django.db.models.deletion.CASCADE, related_name='children', - to='core.attributegroup', verbose_name='parent attribute group')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "name", + models.CharField( + help_text="attribute group's name", max_length=255, verbose_name="attribute group's name" + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_en_US", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + verbose_name="attribute group's name", + ), + ), + ( + "parent", + models.ForeignKey( + blank=True, + help_text="parent of this group", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="children", + to="core.attributegroup", + verbose_name="parent attribute group", + ), + ), ], options={ - 'verbose_name': 'attribute group', - 'verbose_name_plural': 'attribute groups', + "verbose_name": "attribute group", + "verbose_name_plural": "attribute groups", }, ), migrations.CreateModel( - name='Attribute', + name="Attribute", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('value_type', models.CharField( - choices=[('string', 'string'), ('integer', 'integer'), ('float', 'float'), ('boolean', 'boolean'), - ('array', 'array'), ('object', 'object')], help_text="type of the attribute's value", - max_length=50, verbose_name='value type')), - ('name', - models.CharField(help_text='name of this attribute', max_length=255, verbose_name="attribute's name")), - ('name_en_GB', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_ar_AR', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_cs_CZ', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_da_DK', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_de_DE', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_en_US', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_es_ES', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_fr_FR', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_hi_IN', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_it_IT', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_ja_JP', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_kk_KZ', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_nl_NL', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_pl_PL', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_pt_BR', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_ro_RO', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_ru_RU', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('name_zh_hans', models.CharField(help_text='name of this attribute', max_length=255, null=True, - verbose_name="attribute's name")), - ('group', - models.ForeignKey(help_text='group of this attribute', on_delete=django.db.models.deletion.CASCADE, - related_name='attributes', to='core.attributegroup', - verbose_name='attribute group')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "value_type", + models.CharField( + choices=[ + ("string", "string"), + ("integer", "integer"), + ("float", "float"), + ("boolean", "boolean"), + ("array", "array"), + ("object", "object"), + ], + help_text="type of the attribute's value", + max_length=50, + verbose_name="value type", + ), + ), + ( + "name", + models.CharField( + help_text="name of this attribute", max_length=255, verbose_name="attribute's name" + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_en_US", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="name of this attribute", max_length=255, null=True, verbose_name="attribute's name" + ), + ), + ( + "group", + models.ForeignKey( + help_text="group of this attribute", + on_delete=django.db.models.deletion.CASCADE, + related_name="attributes", + to="core.attributegroup", + verbose_name="attribute group", + ), + ), ], options={ - 'verbose_name': 'attribute', - 'verbose_name_plural': 'attributes', + "verbose_name": "attribute", + "verbose_name_plural": "attributes", }, ), migrations.CreateModel( - name='AttributeValue', + name="AttributeValue", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('value', - models.TextField(help_text='the specific value for this attribute', verbose_name='attribute value')), - ('value_en_GB', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_ar_AR', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_cs_CZ', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_da_DK', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_de_DE', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_en_US', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_es_ES', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_fr_FR', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_hi_IN', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_it_IT', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_ja_JP', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_kk_KZ', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_nl_NL', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_pl_PL', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_pt_BR', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_ro_RO', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_ru_RU', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('value_zh_hans', models.TextField(help_text='the specific value for this attribute', null=True, - verbose_name='attribute value')), - ('attribute', - models.ForeignKey(help_text='attribute of this value', on_delete=django.db.models.deletion.CASCADE, - related_name='values', to='core.attribute', verbose_name='attribute')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "value", + models.TextField(help_text="the specific value for this attribute", verbose_name="attribute value"), + ), + ( + "value_en_GB", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_ar_AR", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_cs_CZ", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_da_DK", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_de_DE", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_en_US", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_es_ES", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_fr_FR", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_hi_IN", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_it_IT", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_ja_JP", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_kk_KZ", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_nl_NL", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_pl_PL", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_pt_BR", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_ro_RO", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_ru_RU", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "value_zh_hans", + models.TextField( + help_text="the specific value for this attribute", null=True, verbose_name="attribute value" + ), + ), + ( + "attribute", + models.ForeignKey( + help_text="attribute of this value", + on_delete=django.db.models.deletion.CASCADE, + related_name="values", + to="core.attribute", + verbose_name="attribute", + ), + ), ], options={ - 'verbose_name': 'attribute value', - 'verbose_name_plural': 'attribute values', + "verbose_name": "attribute value", + "verbose_name_plural": "attribute values", }, ), migrations.CreateModel( - name='Category', + name="Category", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('image', models.ImageField(help_text='upload an image representing this category', null=True, - upload_to='categories/', - validators=[core.validators.validate_category_image_dimensions], - verbose_name='category image')), - ('markup_percent', - models.IntegerField(default=0, help_text='define a markup percentage for products in this category', - validators=[django.core.validators.MinValueValidator(0), - django.core.validators.MaxValueValidator(100)], - verbose_name='markup percentage')), - ('name', models.CharField(help_text='provide a name for this category', max_length=255, - verbose_name='category name')), - ('name_en_GB', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_ar_AR', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_cs_CZ', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_da_DK', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_de_DE', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_en_US', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_es_ES', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_fr_FR', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_hi_IN', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_it_IT', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_ja_JP', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_kk_KZ', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_nl_NL', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_pl_PL', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_pt_BR', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_ro_RO', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_ru_RU', models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('name_zh_hans', - models.CharField(help_text='provide a name for this category', max_length=255, null=True, - verbose_name='category name')), - ('description', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_en_GB', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_ar_AR', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_cs_CZ', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_da_DK', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_de_DE', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_en_US', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_es_ES', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_fr_FR', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_hi_IN', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_it_IT', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_ja_JP', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_kk_KZ', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_nl_NL', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_pl_PL', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_pt_BR', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_ro_RO', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_ru_RU', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('description_zh_hans', - models.TextField(blank=True, help_text='add a detailed description for this category', null=True, - verbose_name='category description')), - ('lft', models.PositiveIntegerField(editable=False)), - ('rght', models.PositiveIntegerField(editable=False)), - ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), - ('level', models.PositiveIntegerField(editable=False)), - ('parent', mptt.fields.TreeForeignKey(blank=True, - help_text='parent of this category to form a hierarchical structure', - null=True, on_delete=django.db.models.deletion.CASCADE, - related_name='children', to='core.category', - verbose_name='parent category')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "image", + models.ImageField( + help_text="upload an image representing this category", + null=True, + upload_to="categories/", + validators=[core.validators.validate_category_image_dimensions], + verbose_name="category image", + ), + ), + ( + "markup_percent", + models.IntegerField( + default=0, + help_text="define a markup percentage for products in this category", + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(100), + ], + verbose_name="markup percentage", + ), + ), + ( + "name", + models.CharField( + help_text="provide a name for this category", max_length=255, verbose_name="category name" + ), + ), + ( + "name_en_GB", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_ar_AR", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_cs_CZ", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_da_DK", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_de_DE", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_en_US", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_es_ES", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_fr_FR", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_hi_IN", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_it_IT", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_ja_JP", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_kk_KZ", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_nl_NL", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_pl_PL", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_pt_BR", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_ro_RO", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_ru_RU", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + verbose_name="category name", + ), + ), + ( + "description", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_en_GB", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_ar_AR", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_cs_CZ", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_da_DK", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_de_DE", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_en_US", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_es_ES", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_fr_FR", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_hi_IN", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_it_IT", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_ja_JP", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_kk_KZ", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_nl_NL", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_pl_PL", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_pt_BR", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_ro_RO", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_ru_RU", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ( + "description_zh_hans", + models.TextField( + blank=True, + help_text="add a detailed description for this category", + null=True, + verbose_name="category description", + ), + ), + ("lft", models.PositiveIntegerField(editable=False)), + ("rght", models.PositiveIntegerField(editable=False)), + ("tree_id", models.PositiveIntegerField(db_index=True, editable=False)), + ("level", models.PositiveIntegerField(editable=False)), + ( + "parent", + mptt.fields.TreeForeignKey( + blank=True, + help_text="parent of this category to form a hierarchical structure", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="children", + to="core.category", + verbose_name="parent category", + ), + ), ], options={ - 'verbose_name': 'category', - 'verbose_name_plural': 'categories', - 'ordering': ['tree_id', 'lft'], + "verbose_name": "category", + "verbose_name_plural": "categories", + "ordering": ["tree_id", "lft"], }, ), migrations.CreateModel( - name='Brand', + name="Brand", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('name', models.CharField(help_text='name of this brand', max_length=255, verbose_name='brand name')), - ('category', - models.ForeignKey(blank=True, help_text='optional category that this brand is associated with', - null=True, on_delete=django.db.models.deletion.PROTECT, to='core.category', - verbose_name='associated category')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("name", models.CharField(help_text="name of this brand", max_length=255, verbose_name="brand name")), + ( + "category", + models.ForeignKey( + blank=True, + help_text="optional category that this brand is associated with", + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="core.category", + verbose_name="associated category", + ), + ), ], options={ - 'verbose_name': 'brand', - 'verbose_name_plural': 'brands', + "verbose_name": "brand", + "verbose_name_plural": "brands", }, ), migrations.AddField( - model_name='attribute', - name='categories', - field=models.ManyToManyField(help_text='category of this attribute', related_name='attributes', - to='core.category', verbose_name='categories'), + model_name="attribute", + name="categories", + field=models.ManyToManyField( + help_text="category of this attribute", + related_name="attributes", + to="core.category", + verbose_name="categories", + ), ), migrations.CreateModel( - name='Order', + name="Order", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('status', models.CharField( - choices=[('PENDING', 'pending'), ('FAILED', 'failed'), ('PAYMENT', 'payment'), - ('CREATED', 'created'), ('DELIVERING', 'delivering'), ('FINISHED', 'finished')], - default='PENDING', help_text='current status of the order in its lifecycle', max_length=64, - verbose_name='order status')), - ('notifications', - models.JSONField(blank=True, help_text='json structure of notifications to display to users', - null=True, verbose_name='notifications')), - ('attributes', - models.JSONField(blank=True, help_text='json representation of order attributes for this order', - null=True, verbose_name='attributes')), - ('buy_time', - models.DateTimeField(blank=True, default=None, help_text='the timestamp when the order was finalized', - null=True, verbose_name='buy time')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "status", + models.CharField( + choices=[ + ("PENDING", "pending"), + ("FAILED", "failed"), + ("PAYMENT", "payment"), + ("CREATED", "created"), + ("DELIVERING", "delivering"), + ("FINISHED", "finished"), + ], + default="PENDING", + help_text="current status of the order in its lifecycle", + max_length=64, + verbose_name="order status", + ), + ), + ( + "notifications", + models.JSONField( + blank=True, + help_text="json structure of notifications to display to users", + null=True, + verbose_name="notifications", + ), + ), + ( + "attributes", + models.JSONField( + blank=True, + help_text="json representation of order attributes for this order", + null=True, + verbose_name="attributes", + ), + ), + ( + "buy_time", + models.DateTimeField( + blank=True, + default=None, + help_text="the timestamp when the order was finalized", + null=True, + verbose_name="buy time", + ), + ), ], options={ - 'verbose_name': 'order', - 'verbose_name_plural': 'orders', + "verbose_name": "order", + "verbose_name_plural": "orders", }, ), ] diff --git a/core/migrations/0002_initial.py b/core/migrations/0002_initial.py index af993959..8907808a 100644 --- a/core/migrations/0002_initial.py +++ b/core/migrations/0002_initial.py @@ -7,101 +7,205 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ - ('core', '0001_initial'), + ("core", "0001_initial"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.AddField( - model_name='order', - name='user', - field=models.ForeignKey(help_text='the user who placed the order', on_delete=django.db.models.deletion.CASCADE, related_name='orders', to=settings.AUTH_USER_MODEL, verbose_name='user'), + model_name="order", + name="user", + field=models.ForeignKey( + help_text="the user who placed the order", + on_delete=django.db.models.deletion.CASCADE, + related_name="orders", + to=settings.AUTH_USER_MODEL, + verbose_name="user", + ), ), migrations.AddField( - model_name='orderproduct', - name='order', - field=models.ForeignKey(help_text='reference to the parent order that contains this product', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='order_products', to='core.order', verbose_name='parent order'), + model_name="orderproduct", + name="order", + field=models.ForeignKey( + help_text="reference to the parent order that contains this product", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="order_products", + to="core.order", + verbose_name="parent order", + ), ), migrations.AddField( - model_name='feedback', - name='order_product', - field=models.OneToOneField(help_text='references the specific product in an order that this feedback is about', on_delete=django.db.models.deletion.CASCADE, to='core.orderproduct', verbose_name='related order product'), + model_name="feedback", + name="order_product", + field=models.OneToOneField( + help_text="references the specific product in an order that this feedback is about", + on_delete=django.db.models.deletion.CASCADE, + to="core.orderproduct", + verbose_name="related order product", + ), ), migrations.AddField( - model_name='product', - name='brand', - field=models.ForeignKey(blank=True, help_text='optionally associate this product with a brand', null=True, on_delete=django.db.models.deletion.CASCADE, to='core.brand', verbose_name='brand'), + model_name="product", + name="brand", + field=models.ForeignKey( + blank=True, + help_text="optionally associate this product with a brand", + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="core.brand", + verbose_name="brand", + ), ), migrations.AddField( - model_name='product', - name='category', - field=models.ForeignKey(help_text='category this product belongs to', on_delete=django.db.models.deletion.CASCADE, to='core.category', verbose_name='category'), + model_name="product", + name="category", + field=models.ForeignKey( + help_text="category this product belongs to", + on_delete=django.db.models.deletion.CASCADE, + to="core.category", + verbose_name="category", + ), ), migrations.AddField( - model_name='orderproduct', - name='product', - field=models.ForeignKey(blank=True, help_text='the specific product associated with this order line', null=True, on_delete=django.db.models.deletion.PROTECT, to='core.product', verbose_name='associated product'), + model_name="orderproduct", + name="product", + field=models.ForeignKey( + blank=True, + help_text="the specific product associated with this order line", + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="core.product", + verbose_name="associated product", + ), ), migrations.AddField( - model_name='attributevalue', - name='product', - field=models.ForeignKey(help_text="the specific product associated with this attribute's value", null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attributes', to='core.product', verbose_name='associated product'), + model_name="attributevalue", + name="product", + field=models.ForeignKey( + help_text="the specific product associated with this attribute's value", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="attributes", + to="core.product", + verbose_name="associated product", + ), ), migrations.AddField( - model_name='productimage', - name='product', - field=models.ForeignKey(help_text='the product that this image represents', on_delete=django.db.models.deletion.CASCADE, related_name='images', to='core.product', verbose_name='associated product'), + model_name="productimage", + name="product", + field=models.ForeignKey( + help_text="the product that this image represents", + on_delete=django.db.models.deletion.CASCADE, + related_name="images", + to="core.product", + verbose_name="associated product", + ), ), migrations.AddField( - model_name='product', - name='tags', - field=models.ManyToManyField(blank=True, help_text='tags that help describe or group this product', to='core.producttag', verbose_name='product tags'), + model_name="product", + name="tags", + field=models.ManyToManyField( + blank=True, + help_text="tags that help describe or group this product", + to="core.producttag", + verbose_name="product tags", + ), ), migrations.AddField( - model_name='promocode', - name='user', - field=models.ForeignKey(blank=True, help_text='user assigned to this promocode if applicable', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='promocodes', to=settings.AUTH_USER_MODEL, verbose_name='assigned user'), + model_name="promocode", + name="user", + field=models.ForeignKey( + blank=True, + help_text="user assigned to this promocode if applicable", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="promocodes", + to=settings.AUTH_USER_MODEL, + verbose_name="assigned user", + ), ), migrations.AddField( - model_name='order', - name='promo_code', - field=models.ForeignKey(blank=True, help_text='optional promo code applied to this order', null=True, on_delete=django.db.models.deletion.PROTECT, to='core.promocode', verbose_name='applied promo code'), + model_name="order", + name="promo_code", + field=models.ForeignKey( + blank=True, + help_text="optional promo code applied to this order", + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="core.promocode", + verbose_name="applied promo code", + ), ), migrations.AddField( - model_name='promotion', - name='products', - field=models.ManyToManyField(blank=True, help_text='select which products are included in this promotion', to='core.product', verbose_name='included products'), + model_name="promotion", + name="products", + field=models.ManyToManyField( + blank=True, + help_text="select which products are included in this promotion", + to="core.product", + verbose_name="included products", + ), ), migrations.AddField( - model_name='stock', - name='product', - field=models.ForeignKey(blank=True, help_text='the product associated with this stock entry', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='stocks', to='core.product', verbose_name='associated product'), + model_name="stock", + name="product", + field=models.ForeignKey( + blank=True, + help_text="the product associated with this stock entry", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="stocks", + to="core.product", + verbose_name="associated product", + ), ), migrations.AddIndex( - model_name='vendor', - index=django.contrib.postgres.indexes.GinIndex(fields=['authentication'], name='core_vendor_authent_80dc1f_gin'), + model_name="vendor", + index=django.contrib.postgres.indexes.GinIndex( + fields=["authentication"], name="core_vendor_authent_80dc1f_gin" + ), ), migrations.AddField( - model_name='stock', - name='vendor', - field=models.ForeignKey(help_text='the vendor supplying this product stock', on_delete=django.db.models.deletion.CASCADE, to='core.vendor', verbose_name='associated vendor'), + model_name="stock", + name="vendor", + field=models.ForeignKey( + help_text="the vendor supplying this product stock", + on_delete=django.db.models.deletion.CASCADE, + to="core.vendor", + verbose_name="associated vendor", + ), ), migrations.AddField( - model_name='wishlist', - name='products', - field=models.ManyToManyField(blank=True, help_text='products that the user has marked as wanted', to='core.product', verbose_name='wishlisted products'), + model_name="wishlist", + name="products", + field=models.ManyToManyField( + blank=True, + help_text="products that the user has marked as wanted", + to="core.product", + verbose_name="wishlisted products", + ), ), migrations.AddField( - model_name='wishlist', - name='user', - field=models.OneToOneField(blank=True, help_text='user who owns this wishlist', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_related_wishlist', to=settings.AUTH_USER_MODEL, verbose_name='wishlist owner'), + model_name="wishlist", + name="user", + field=models.OneToOneField( + blank=True, + help_text="user who owns this wishlist", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="user_related_wishlist", + to=settings.AUTH_USER_MODEL, + verbose_name="wishlist owner", + ), ), migrations.AddIndex( - model_name='orderproduct', - index=django.contrib.postgres.indexes.GinIndex(fields=['notifications', 'attributes'], name='core_orderp_notific_cd27e9_gin'), + model_name="orderproduct", + index=django.contrib.postgres.indexes.GinIndex( + fields=["notifications", "attributes"], name="core_orderp_notific_cd27e9_gin" + ), ), ] diff --git a/core/migrations/0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more.py b/core/migrations/0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more.py index 769a5a5f..80caf008 100644 --- a/core/migrations/0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more.py +++ b/core/migrations/0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more.py @@ -4,495 +4,1054 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0002_initial'), + ("core", "0002_initial"), ] operations = [ migrations.AlterField( - model_name='attribute', - name='name', - field=models.CharField(help_text='name of this attribute', max_length=255, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_ar_AR', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_cs_CZ', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_da_DK', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_de_DE', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_en_GB', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_en_US', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_es_ES', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_fr_FR', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_hi_IN', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_it_IT', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_ja_JP', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_kk_KZ', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_nl_NL', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_pl_PL', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_pt_BR', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_ro_RO', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_ru_RU', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attribute', - name='name_zh_hans', - field=models.CharField(help_text='name of this attribute', max_length=255, null=True, unique=True, verbose_name="attribute's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name', - field=models.CharField(help_text="attribute group's name", max_length=255, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_ar_AR', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_cs_CZ', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_da_DK', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_de_DE', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_en_GB', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_en_US', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_es_ES', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_fr_FR', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_hi_IN', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_it_IT', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_ja_JP', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_kk_KZ', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_nl_NL', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_pl_PL', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_pt_BR', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_ro_RO', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_ru_RU', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='attributegroup', - name='name_zh_hans', - field=models.CharField(help_text="attribute group's name", max_length=255, null=True, unique=True, verbose_name="attribute group's name"), - ), - migrations.AlterField( - model_name='brand', - name='name', - field=models.CharField(help_text='name of this brand', max_length=255, unique=True, verbose_name='brand name'), - ), - migrations.AlterField( - model_name='category', - name='name', - field=models.CharField(help_text='provide a name for this category', max_length=255, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_ar_AR', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_cs_CZ', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_da_DK', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_de_DE', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_en_GB', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_en_US', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_es_ES', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_fr_FR', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_hi_IN', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_it_IT', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_ja_JP', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_kk_KZ', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_nl_NL', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_pl_PL', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_pt_BR', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_ro_RO', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_ru_RU', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='category', - name='name_zh_hans', - field=models.CharField(help_text='provide a name for this category', max_length=255, null=True, unique=True, verbose_name='category name'), - ), - migrations.AlterField( - model_name='product', - name='name', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_ar_AR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_cs_CZ', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_da_DK', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_de_DE', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_en_GB', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_en_US', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_es_ES', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_fr_FR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_hi_IN', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_it_IT', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_ja_JP', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_kk_KZ', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_nl_NL', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_pl_PL', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_pt_BR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_ro_RO', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_ru_RU', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='product', - name='name_zh_hans', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, unique=True, verbose_name='product name'), - ), - migrations.AlterField( - model_name='producttag', - name='name', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_ar_AR', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_cs_CZ', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_da_DK', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_de_DE', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_en_GB', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_en_US', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_es_ES', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_fr_FR', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_hi_IN', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_it_IT', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_ja_JP', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_kk_KZ', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_nl_NL', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_pl_PL', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_pt_BR', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_ro_RO', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_ru_RU', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='producttag', - name='name_zh_hans', - field=models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, unique=True, verbose_name='tag display name'), - ), - migrations.AlterField( - model_name='vendor', - name='name', - field=models.CharField(help_text='name of this vendor', max_length=255, unique=True, verbose_name='vendor name'), + model_name="attribute", + name="name", + field=models.CharField( + help_text="name of this attribute", max_length=255, unique=True, verbose_name="attribute's name" + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_ar_AR", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_cs_CZ", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_da_DK", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_de_DE", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_en_GB", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_en_US", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_es_ES", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_fr_FR", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_hi_IN", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_it_IT", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_ja_JP", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_kk_KZ", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_nl_NL", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_pl_PL", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_pt_BR", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_ro_RO", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_ru_RU", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attribute", + name="name_zh_hans", + field=models.CharField( + help_text="name of this attribute", + max_length=255, + null=True, + unique=True, + verbose_name="attribute's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name", + field=models.CharField( + help_text="attribute group's name", max_length=255, unique=True, verbose_name="attribute group's name" + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_ar_AR", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_cs_CZ", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_da_DK", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_de_DE", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_en_GB", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_en_US", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_es_ES", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_fr_FR", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_hi_IN", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_it_IT", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_ja_JP", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_kk_KZ", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_nl_NL", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_pl_PL", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_pt_BR", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_ro_RO", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_ru_RU", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="attributegroup", + name="name_zh_hans", + field=models.CharField( + help_text="attribute group's name", + max_length=255, + null=True, + unique=True, + verbose_name="attribute group's name", + ), + ), + migrations.AlterField( + model_name="brand", + name="name", + field=models.CharField( + help_text="name of this brand", max_length=255, unique=True, verbose_name="brand name" + ), + ), + migrations.AlterField( + model_name="category", + name="name", + field=models.CharField( + help_text="provide a name for this category", max_length=255, unique=True, verbose_name="category name" + ), + ), + migrations.AlterField( + model_name="category", + name="name_ar_AR", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_cs_CZ", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_da_DK", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_de_DE", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_en_GB", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_en_US", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_es_ES", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_fr_FR", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_hi_IN", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_it_IT", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_ja_JP", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_kk_KZ", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_nl_NL", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_pl_PL", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_pt_BR", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_ro_RO", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_ru_RU", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="category", + name="name_zh_hans", + field=models.CharField( + help_text="provide a name for this category", + max_length=255, + null=True, + unique=True, + verbose_name="category name", + ), + ), + migrations.AlterField( + model_name="product", + name="name", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_ar_AR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_cs_CZ", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_da_DK", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_de_DE", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_en_GB", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_en_US", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_es_ES", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_fr_FR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_hi_IN", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_it_IT", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_ja_JP", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_kk_KZ", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_nl_NL", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_pl_PL", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_pt_BR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_ro_RO", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_ru_RU", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="product", + name="name_zh_hans", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + unique=True, + verbose_name="product name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_ar_AR", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_cs_CZ", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_da_DK", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_de_DE", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_en_GB", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_en_US", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_es_ES", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_fr_FR", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_hi_IN", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_it_IT", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_ja_JP", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_kk_KZ", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_nl_NL", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_pl_PL", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_pt_BR", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_ro_RO", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_ru_RU", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="producttag", + name="name_zh_hans", + field=models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + migrations.AlterField( + model_name="vendor", + name="name", + field=models.CharField( + help_text="name of this vendor", max_length=255, unique=True, verbose_name="vendor name" + ), ), ] diff --git a/core/migrations/0004_alter_product_name_alter_product_name_ar_ar_and_more.py b/core/migrations/0004_alter_product_name_alter_product_name_ar_ar_and_more.py index 6e36c2d6..a47d03af 100644 --- a/core/migrations/0004_alter_product_name_alter_product_name_ar_ar_and_more.py +++ b/core/migrations/0004_alter_product_name_alter_product_name_ar_ar_and_more.py @@ -4,105 +4,198 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more'), + ("core", "0003_alter_attribute_name_alter_attribute_name_ar_ar_and_more"), ] operations = [ migrations.AlterField( - model_name='product', - name='name', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, verbose_name='product name'), + model_name="product", + name="name", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_ar_AR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_ar_AR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_cs_CZ', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_cs_CZ", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_da_DK', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_da_DK", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_de_DE', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_de_DE", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_en_GB', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_en_GB", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_en_US', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_en_US", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_es_ES', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_es_ES", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_fr_FR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_fr_FR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_hi_IN', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_hi_IN", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_it_IT', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_it_IT", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_ja_JP', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_ja_JP", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_kk_KZ', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_kk_KZ", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_nl_NL', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_nl_NL", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_pl_PL', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_pl_PL", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_pt_BR', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_pt_BR", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_ro_RO', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_ro_RO", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_ru_RU', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_ru_RU", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), migrations.AlterField( - model_name='product', - name='name_zh_hans', - field=models.CharField(help_text='provide a clear identifying name for the product', max_length=255, null=True, verbose_name='product name'), + model_name="product", + name="name_zh_hans", + field=models.CharField( + help_text="provide a clear identifying name for the product", + max_length=255, + null=True, + verbose_name="product name", + ), ), ] diff --git a/core/migrations/0005_remove_brand_category_brand_categories.py b/core/migrations/0005_remove_brand_category_brand_categories.py index ed34cded..176538a3 100644 --- a/core/migrations/0005_remove_brand_category_brand_categories.py +++ b/core/migrations/0005_remove_brand_category_brand_categories.py @@ -4,19 +4,23 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0004_alter_product_name_alter_product_name_ar_ar_and_more'), + ("core", "0004_alter_product_name_alter_product_name_ar_ar_and_more"), ] operations = [ migrations.RemoveField( - model_name='brand', - name='category', + model_name="brand", + name="category", ), migrations.AddField( - model_name='brand', - name='categories', - field=models.ManyToManyField(blank=True, help_text='optional categories that this brand is associated with', to='core.category', verbose_name='associated categories'), + model_name="brand", + name="categories", + field=models.ManyToManyField( + blank=True, + help_text="optional categories that this brand is associated with", + to="core.category", + verbose_name="associated categories", + ), ), ] diff --git a/core/migrations/0006_alter_order_status.py b/core/migrations/0006_alter_order_status.py index 109fac86..41fd1bf9 100644 --- a/core/migrations/0006_alter_order_status.py +++ b/core/migrations/0006_alter_order_status.py @@ -4,15 +4,28 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0005_remove_brand_category_brand_categories'), + ("core", "0005_remove_brand_category_brand_categories"), ] operations = [ migrations.AlterField( - model_name='order', - name='status', - field=models.CharField(choices=[('PENDING', 'pending'), ('FAILED', 'failed'), ('PAYMENT', 'payment'), ('CREATED', 'created'), ('DELIVERING', 'delivering'), ('FINISHED', 'finished'), ('MOMENTAL', 'momental')], default='PENDING', help_text='current status of the order in its lifecycle', max_length=64, verbose_name='order status'), + model_name="order", + name="status", + field=models.CharField( + choices=[ + ("PENDING", "pending"), + ("FAILED", "failed"), + ("PAYMENT", "payment"), + ("CREATED", "created"), + ("DELIVERING", "delivering"), + ("FINISHED", "finished"), + ("MOMENTAL", "momental"), + ], + default="PENDING", + help_text="current status of the order in its lifecycle", + max_length=64, + verbose_name="order status", + ), ), ] diff --git a/core/migrations/0007_alter_category_image.py b/core/migrations/0007_alter_category_image.py index 25ffc9c1..77939b03 100644 --- a/core/migrations/0007_alter_category_image.py +++ b/core/migrations/0007_alter_category_image.py @@ -7,16 +7,20 @@ import core.validators class Migration(migrations.Migration): dependencies = [ - ('core', '0006_alter_order_status'), + ("core", "0006_alter_order_status"), ] operations = [ migrations.AlterField( - model_name='category', - name='image', - field=models.ImageField(blank=True, help_text='upload an image representing this category', null=True, - upload_to='categories/', - validators=[core.validators.validate_category_image_dimensions], - verbose_name='category image'), + model_name="category", + name="image", + field=models.ImageField( + blank=True, + help_text="upload an image representing this category", + null=True, + upload_to="categories/", + validators=[core.validators.validate_category_image_dimensions], + verbose_name="category image", + ), ), ] diff --git a/core/migrations/0008_digitalassetdownload.py b/core/migrations/0008_digitalassetdownload.py index 5739ebb5..32a3873e 100644 --- a/core/migrations/0008_digitalassetdownload.py +++ b/core/migrations/0008_digitalassetdownload.py @@ -9,33 +9,57 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0007_alter_category_image'), + ("core", "0007_alter_category_image"), ] operations = [ migrations.CreateModel( - name='DigitalAssetDownload', + name="DigitalAssetDownload", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('num_downloads', models.IntegerField(default=0)), - ('order_product', - models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='download', - to='core.orderproduct')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("num_downloads", models.IntegerField(default=0)), + ( + "order_product", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, related_name="download", to="core.orderproduct" + ), + ), ], options={ - 'verbose_name': 'download', - 'verbose_name_plural': 'downloads', + "verbose_name": "download", + "verbose_name_plural": "downloads", }, ), ] diff --git a/core/migrations/0009_documentary.py b/core/migrations/0009_documentary.py index d368b1c9..8beb86b4 100644 --- a/core/migrations/0009_documentary.py +++ b/core/migrations/0009_documentary.py @@ -11,32 +11,57 @@ import core.utils class Migration(migrations.Migration): dependencies = [ - ('core', '0008_digitalassetdownload'), + ("core", "0008_digitalassetdownload"), ] operations = [ migrations.CreateModel( - name='Documentary', + name="Documentary", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('document', models.FileField(upload_to=core.utils.get_product_uuid_as_path)), - ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documentaries', - to='core.product')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("document", models.FileField(upload_to=core.utils.get_product_uuid_as_path)), + ( + "product", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="documentaries", to="core.product" + ), + ), ], options={ - 'verbose_name': 'documentary', - 'verbose_name_plural': 'documentaries', + "verbose_name": "documentary", + "verbose_name_plural": "documentaries", }, ), ] diff --git a/core/migrations/0010_product_partnumber.py b/core/migrations/0010_product_partnumber.py index e447e697..3628270e 100644 --- a/core/migrations/0010_product_partnumber.py +++ b/core/migrations/0010_product_partnumber.py @@ -4,15 +4,20 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0009_documentary'), + ("core", "0009_documentary"), ] operations = [ migrations.AddField( - model_name='product', - name='partnumber', - field=models.CharField(default=None, help_text='part number for this product', null=True, unique=True, verbose_name='part number'), + model_name="product", + name="partnumber", + field=models.CharField( + default=None, + help_text="part number for this product", + null=True, + unique=True, + verbose_name="part number", + ), ), ] diff --git a/core/migrations/0011_brand_big_logo_brand_description_and_more.py b/core/migrations/0011_brand_big_logo_brand_description_and_more.py index 53e8890a..8dbb4df0 100644 --- a/core/migrations/0011_brand_big_logo_brand_description_and_more.py +++ b/core/migrations/0011_brand_big_logo_brand_description_and_more.py @@ -7,138 +7,222 @@ import core.validators class Migration(migrations.Migration): dependencies = [ - ('core', '0010_product_partnumber'), + ("core", "0010_product_partnumber"), ] operations = [ migrations.AddField( - model_name='brand', - name='big_logo', - field=models.ImageField(blank=True, help_text='upload a big logo representing this brand', null=True, - upload_to='brands/', - validators=[core.validators.validate_category_image_dimensions], - verbose_name='brand big image'), + model_name="brand", + name="big_logo", + field=models.ImageField( + blank=True, + help_text="upload a big logo representing this brand", + null=True, + upload_to="brands/", + validators=[core.validators.validate_category_image_dimensions], + verbose_name="brand big image", + ), ), migrations.AddField( - model_name='brand', - name='description', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_ar_AR', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_ar_AR", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_cs_CZ', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_cs_CZ", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_da_DK', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_da_DK", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_de_DE', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_de_DE", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_en_GB', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_en_GB", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_en_US', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_en_US", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_es_ES', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_es_ES", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_fr_FR', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_fr_FR", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_hi_IN', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_hi_IN", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_it_IT', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_it_IT", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_ja_JP', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_ja_JP", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_kk_KZ', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_kk_KZ", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_nl_NL', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_nl_NL", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_pl_PL', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_pl_PL", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_pt_BR', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_pt_BR", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_ro_RO', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_ro_RO", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_ru_RU', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_ru_RU", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='description_zh_hans', - field=models.TextField(blank=True, help_text='add a detailed description of the brand', null=True, - verbose_name='brand description'), + model_name="brand", + name="description_zh_hans", + field=models.TextField( + blank=True, + help_text="add a detailed description of the brand", + null=True, + verbose_name="brand description", + ), ), migrations.AddField( - model_name='brand', - name='small_logo', - field=models.ImageField(blank=True, help_text='upload a logo representing this brand', null=True, - upload_to='brands/', - validators=[core.validators.validate_category_image_dimensions], - verbose_name='brand small image'), + model_name="brand", + name="small_logo", + field=models.ImageField( + blank=True, + help_text="upload a logo representing this brand", + null=True, + upload_to="brands/", + validators=[core.validators.validate_category_image_dimensions], + verbose_name="brand small image", + ), ), ] diff --git a/core/migrations/0012_alter_order_user.py b/core/migrations/0012_alter_order_user.py index 97465a31..2213f5ab 100644 --- a/core/migrations/0012_alter_order_user.py +++ b/core/migrations/0012_alter_order_user.py @@ -6,16 +6,23 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('core', '0011_brand_big_logo_brand_description_and_more'), + ("core", "0011_brand_big_logo_brand_description_and_more"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.AlterField( - model_name='order', - name='user', - field=models.ForeignKey(blank=True, help_text='the user who placed the order', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders', to=settings.AUTH_USER_MODEL, verbose_name='user'), + model_name="order", + name="user", + field=models.ForeignKey( + blank=True, + help_text="the user who placed the order", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="orders", + to=settings.AUTH_USER_MODEL, + verbose_name="user", + ), ), ] diff --git a/core/migrations/0013_product_slug.py b/core/migrations/0013_product_slug.py index fbf8b75f..412aeef4 100644 --- a/core/migrations/0013_product_slug.py +++ b/core/migrations/0013_product_slug.py @@ -5,15 +5,21 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('core', '0012_alter_order_user'), + ("core", "0012_alter_order_user"), ] operations = [ migrations.AddField( - model_name='product', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, null=True, blank=True, editable=False, populate_from=('category.name', 'brand.name', 'name'), unique=True), + model_name="product", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, + null=True, + blank=True, + editable=False, + populate_from=("category.name", "brand.name", "name"), + unique=True, + ), ), ] diff --git a/core/migrations/0014_alter_product_slug.py b/core/migrations/0014_alter_product_slug.py index b1b5f7f4..db3fba48 100644 --- a/core/migrations/0014_alter_product_slug.py +++ b/core/migrations/0014_alter_product_slug.py @@ -5,15 +5,21 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('core', '0013_product_slug'), + ("core", "0013_product_slug"), ] operations = [ migrations.AlterField( - model_name='product', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, blank=True, editable=False, null=True, populate_from=('uuid', 'category.name', 'brand.name', 'name'), unique=True), + model_name="product", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, + blank=True, + editable=False, + null=True, + populate_from=("uuid", "category.name", "brand.name", "name"), + unique=True, + ), ), ] diff --git a/core/migrations/0015_alter_product_slug.py b/core/migrations/0015_alter_product_slug.py index 5cd41799..d0d284bf 100644 --- a/core/migrations/0015_alter_product_slug.py +++ b/core/migrations/0015_alter_product_slug.py @@ -5,15 +5,21 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('core', '0014_alter_product_slug'), + ("core", "0014_alter_product_slug"), ] operations = [ migrations.AlterField( - model_name='product', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, blank=True, editable=False, null=True, populate_from=('category__name', 'name'), unique=True), + model_name="product", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, + blank=True, + editable=False, + null=True, + populate_from=("category__name", "name"), + unique=True, + ), ), ] diff --git a/core/migrations/0016_alter_product_slug.py b/core/migrations/0016_alter_product_slug.py index 32875776..01ed1c17 100644 --- a/core/migrations/0016_alter_product_slug.py +++ b/core/migrations/0016_alter_product_slug.py @@ -5,15 +5,21 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('core', '0015_alter_product_slug'), + ("core", "0015_alter_product_slug"), ] operations = [ migrations.AlterField( - model_name='product', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, blank=True, editable=False, null=True, populate_from=('uuid', 'category__name', 'name'), unique=True), + model_name="product", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, + blank=True, + editable=False, + null=True, + populate_from=("uuid", "category__name", "name"), + unique=True, + ), ), ] diff --git a/core/migrations/0017_order_human_readable_id.py b/core/migrations/0017_order_human_readable_id.py index 48d73cb0..36572585 100644 --- a/core/migrations/0017_order_human_readable_id.py +++ b/core/migrations/0017_order_human_readable_id.py @@ -7,15 +7,18 @@ import core.utils class Migration(migrations.Migration): dependencies = [ - ('core', '0016_alter_product_slug'), + ("core", "0016_alter_product_slug"), ] operations = [ migrations.AddField( - model_name='order', - name='human_readable_id', - field=models.CharField(default=core.utils.generate_human_readable_id, - help_text='a human-readable identifier for the order', max_length=8, - verbose_name='human readable id'), + model_name="order", + name="human_readable_id", + field=models.CharField( + default=core.utils.generate_human_readable_id, + help_text="a human-readable identifier for the order", + max_length=8, + verbose_name="human readable id", + ), ), ] diff --git a/core/migrations/0018_alter_order_human_readable_id.py b/core/migrations/0018_alter_order_human_readable_id.py index 10f7899f..5fe3e70a 100644 --- a/core/migrations/0018_alter_order_human_readable_id.py +++ b/core/migrations/0018_alter_order_human_readable_id.py @@ -8,11 +8,7 @@ def fix_duplicates(apps, schema_editor): if schema_editor: pass Order = apps.get_model("core", "Order") - duplicates = ( - Order.objects.values("human_readable_id") - .annotate(count=Count("uuid")) - .filter(count__gt=1) - ) + duplicates = Order.objects.values("human_readable_id").annotate(count=Count("uuid")).filter(count__gt=1) for duplicate in duplicates: h_id = duplicate["human_readable_id"] orders = Order.objects.filter(human_readable_id=h_id).order_by("uuid") @@ -20,6 +16,7 @@ def fix_duplicates(apps, schema_editor): new_id = order.human_readable_id while Order.objects.filter(human_readable_id=new_id).exists(): from core.utils import generate_human_readable_id + new_id = generate_human_readable_id() order.human_readable_id = new_id order.save() @@ -35,16 +32,20 @@ def reverse_func(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('core', '0017_order_human_readable_id'), + ("core", "0017_order_human_readable_id"), ] operations = [ migrations.RunPython(fix_duplicates, reverse_func), migrations.AlterField( - model_name='order', - name='human_readable_id', - field=models.CharField(default=core.utils.generate_human_readable_id, - help_text='a human-readable identifier for the order', max_length=8, unique=True, - verbose_name='human readable id'), + model_name="order", + name="human_readable_id", + field=models.CharField( + default=core.utils.generate_human_readable_id, + help_text="a human-readable identifier for the order", + max_length=8, + unique=True, + verbose_name="human readable id", + ), ), ] diff --git a/core/migrations/0019_address.py b/core/migrations/0019_address.py index 229c86c6..1c3bce8e 100644 --- a/core/migrations/0019_address.py +++ b/core/migrations/0019_address.py @@ -11,46 +11,86 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0018_alter_order_human_readable_id'), + ("core", "0018_alter_order_human_readable_id"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( - name='Address', + name="Address", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('street', models.CharField(max_length=255, null=True, verbose_name='street')), - ('district', models.CharField(max_length=255, null=True, verbose_name='district')), - ('city', models.CharField(max_length=100, null=True, verbose_name='city')), - ('region', models.CharField(max_length=100, null=True, verbose_name='region')), - ('postal_code', models.CharField(max_length=20, null=True, verbose_name='postal code')), - ('country', models.CharField(max_length=40, null=True, verbose_name='country')), - ('location', django.contrib.gis.db.models.fields.PointField(blank=True, geography=True, - help_text='geolocation point: (longitude, latitude)', - null=True, srid=4326)), - ('raw_data', models.JSONField(blank=True, help_text='full JSON response from geocoder for this address', - null=True)), - ('api_response', - models.JSONField(blank=True, help_text='stored JSON response from the geocoding service', null=True)), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL)), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("street", models.CharField(max_length=255, null=True, verbose_name="street")), + ("district", models.CharField(max_length=255, null=True, verbose_name="district")), + ("city", models.CharField(max_length=100, null=True, verbose_name="city")), + ("region", models.CharField(max_length=100, null=True, verbose_name="region")), + ("postal_code", models.CharField(max_length=20, null=True, verbose_name="postal code")), + ("country", models.CharField(max_length=40, null=True, verbose_name="country")), + ( + "location", + django.contrib.gis.db.models.fields.PointField( + blank=True, + geography=True, + help_text="geolocation point: (longitude, latitude)", + null=True, + srid=4326, + ), + ), + ( + "raw_data", + models.JSONField( + blank=True, help_text="full JSON response from geocoder for this address", null=True + ), + ), + ( + "api_response", + models.JSONField( + blank=True, help_text="stored JSON response from the geocoding service", null=True + ), + ), + ( + "user", + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL + ), + ), ], options={ - 'verbose_name': 'address', - 'verbose_name_plural': 'addresses', - 'indexes': [models.Index(fields=['location'], name='core_addres_locatio_eb6b39_idx')], + "verbose_name": "address", + "verbose_name_plural": "addresses", + "indexes": [models.Index(fields=["location"], name="core_addres_locatio_eb6b39_idx")], }, ), ] diff --git a/core/migrations/0020_order_billing_address_order_shipping_address.py b/core/migrations/0020_order_billing_address_order_shipping_address.py index 430b124e..718186f0 100644 --- a/core/migrations/0020_order_billing_address_order_shipping_address.py +++ b/core/migrations/0020_order_billing_address_order_shipping_address.py @@ -5,7 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0019_address'), + ("core", "0019_address"), ] operations = [ @@ -17,29 +17,30 @@ class Migration(migrations.Migration): ), reverse_sql=migrations.RunSQL.noop, ), - migrations.AddField( - model_name='order', - name='billing_address', + model_name="order", + name="billing_address", field=models.ForeignKey( - blank=True, null=True, + blank=True, + null=True, on_delete=models.deletion.CASCADE, - related_name='billing_address_order', - to='core.address', - verbose_name='billing address', - help_text='the billing address used for this order', + related_name="billing_address_order", + to="core.address", + verbose_name="billing address", + help_text="the billing address used for this order", ), ), migrations.AddField( - model_name='order', - name='shipping_address', + model_name="order", + name="shipping_address", field=models.ForeignKey( - blank=True, null=True, + blank=True, + null=True, on_delete=models.deletion.CASCADE, - related_name='shipping_address_order', - to='core.address', - verbose_name='shipping address', - help_text='the shipping address used for this order', + related_name="shipping_address_order", + to="core.address", + verbose_name="shipping address", + help_text="the shipping address used for this order", ), ), ] diff --git a/core/migrations/0021_rename_name_ar_ar_attribute_name_ar_ar_and_more.py b/core/migrations/0021_rename_name_ar_ar_attribute_name_ar_ar_and_more.py index ca4135dd..26e88bd0 100644 --- a/core/migrations/0021_rename_name_ar_ar_attribute_name_ar_ar_and_more.py +++ b/core/migrations/0021_rename_name_ar_ar_attribute_name_ar_ar_and_more.py @@ -5,943 +5,943 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('core', '0020_order_billing_address_order_shipping_address'), + ("core", "0020_order_billing_address_order_shipping_address"), ] operations = [ migrations.RenameField( - model_name='attribute', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="attribute", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='attribute', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="attribute", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='attribute', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="attribute", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='attribute', - old_name='name_de_DE', - new_name='name_de_de', + model_name="attribute", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='attribute', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="attribute", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='attribute', - old_name='name_en_US', - new_name='name_en_us', + model_name="attribute", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='attribute', - old_name='name_es_ES', - new_name='name_es_es', + model_name="attribute", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='attribute', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="attribute", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='attribute', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="attribute", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='attribute', - old_name='name_it_IT', - new_name='name_it_it', + model_name="attribute", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='attribute', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="attribute", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='attribute', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="attribute", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='attribute', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="attribute", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='attribute', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="attribute", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='attribute', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="attribute", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='attribute', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="attribute", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='attribute', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="attribute", + old_name="name_ru_RU", + new_name="name_ru_ru", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="attributegroup", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="attributegroup", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="attributegroup", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_de_DE', - new_name='name_de_de', + model_name="attributegroup", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="attributegroup", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_en_US', - new_name='name_en_us', + model_name="attributegroup", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_es_ES', - new_name='name_es_es', + model_name="attributegroup", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="attributegroup", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="attributegroup", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_it_IT', - new_name='name_it_it', + model_name="attributegroup", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="attributegroup", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="attributegroup", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="attributegroup", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="attributegroup", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="attributegroup", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="attributegroup", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='attributegroup', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="attributegroup", + old_name="name_ru_RU", + new_name="name_ru_ru", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_ar_AR', - new_name='value_ar_ar', + model_name="attributevalue", + old_name="value_ar_AR", + new_name="value_ar_ar", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_cs_CZ', - new_name='value_cs_cz', + model_name="attributevalue", + old_name="value_cs_CZ", + new_name="value_cs_cz", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_da_DK', - new_name='value_da_dk', + model_name="attributevalue", + old_name="value_da_DK", + new_name="value_da_dk", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_de_DE', - new_name='value_de_de', + model_name="attributevalue", + old_name="value_de_DE", + new_name="value_de_de", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_en_GB', - new_name='value_en_gb', + model_name="attributevalue", + old_name="value_en_GB", + new_name="value_en_gb", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_en_US', - new_name='value_en_us', + model_name="attributevalue", + old_name="value_en_US", + new_name="value_en_us", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_es_ES', - new_name='value_es_es', + model_name="attributevalue", + old_name="value_es_ES", + new_name="value_es_es", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_fr_FR', - new_name='value_fr_fr', + model_name="attributevalue", + old_name="value_fr_FR", + new_name="value_fr_fr", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_hi_IN', - new_name='value_hi_in', + model_name="attributevalue", + old_name="value_hi_IN", + new_name="value_hi_in", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_it_IT', - new_name='value_it_it', + model_name="attributevalue", + old_name="value_it_IT", + new_name="value_it_it", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_ja_JP', - new_name='value_ja_jp', + model_name="attributevalue", + old_name="value_ja_JP", + new_name="value_ja_jp", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_kk_KZ', - new_name='value_kk_kz', + model_name="attributevalue", + old_name="value_kk_KZ", + new_name="value_kk_kz", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_nl_NL', - new_name='value_nl_nl', + model_name="attributevalue", + old_name="value_nl_NL", + new_name="value_nl_nl", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_pl_PL', - new_name='value_pl_pl', + model_name="attributevalue", + old_name="value_pl_PL", + new_name="value_pl_pl", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_pt_BR', - new_name='value_pt_br', + model_name="attributevalue", + old_name="value_pt_BR", + new_name="value_pt_br", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_ro_RO', - new_name='value_ro_ro', + model_name="attributevalue", + old_name="value_ro_RO", + new_name="value_ro_ro", ), migrations.RenameField( - model_name='attributevalue', - old_name='value_ru_RU', - new_name='value_ru_ru', + model_name="attributevalue", + old_name="value_ru_RU", + new_name="value_ru_ru", ), migrations.RenameField( - model_name='brand', - old_name='description_ar_AR', - new_name='description_ar_ar', + model_name="brand", + old_name="description_ar_AR", + new_name="description_ar_ar", ), migrations.RenameField( - model_name='brand', - old_name='description_cs_CZ', - new_name='description_cs_cz', + model_name="brand", + old_name="description_cs_CZ", + new_name="description_cs_cz", ), migrations.RenameField( - model_name='brand', - old_name='description_da_DK', - new_name='description_da_dk', + model_name="brand", + old_name="description_da_DK", + new_name="description_da_dk", ), migrations.RenameField( - model_name='brand', - old_name='description_de_DE', - new_name='description_de_de', + model_name="brand", + old_name="description_de_DE", + new_name="description_de_de", ), migrations.RenameField( - model_name='brand', - old_name='description_en_GB', - new_name='description_en_gb', + model_name="brand", + old_name="description_en_GB", + new_name="description_en_gb", ), migrations.RenameField( - model_name='brand', - old_name='description_en_US', - new_name='description_en_us', + model_name="brand", + old_name="description_en_US", + new_name="description_en_us", ), migrations.RenameField( - model_name='brand', - old_name='description_es_ES', - new_name='description_es_es', + model_name="brand", + old_name="description_es_ES", + new_name="description_es_es", ), migrations.RenameField( - model_name='brand', - old_name='description_fr_FR', - new_name='description_fr_fr', + model_name="brand", + old_name="description_fr_FR", + new_name="description_fr_fr", ), migrations.RenameField( - model_name='brand', - old_name='description_hi_IN', - new_name='description_hi_in', + model_name="brand", + old_name="description_hi_IN", + new_name="description_hi_in", ), migrations.RenameField( - model_name='brand', - old_name='description_it_IT', - new_name='description_it_it', + model_name="brand", + old_name="description_it_IT", + new_name="description_it_it", ), migrations.RenameField( - model_name='brand', - old_name='description_ja_JP', - new_name='description_ja_jp', + model_name="brand", + old_name="description_ja_JP", + new_name="description_ja_jp", ), migrations.RenameField( - model_name='brand', - old_name='description_kk_KZ', - new_name='description_kk_kz', + model_name="brand", + old_name="description_kk_KZ", + new_name="description_kk_kz", ), migrations.RenameField( - model_name='brand', - old_name='description_nl_NL', - new_name='description_nl_nl', + model_name="brand", + old_name="description_nl_NL", + new_name="description_nl_nl", ), migrations.RenameField( - model_name='brand', - old_name='description_pl_PL', - new_name='description_pl_pl', + model_name="brand", + old_name="description_pl_PL", + new_name="description_pl_pl", ), migrations.RenameField( - model_name='brand', - old_name='description_pt_BR', - new_name='description_pt_br', + model_name="brand", + old_name="description_pt_BR", + new_name="description_pt_br", ), migrations.RenameField( - model_name='brand', - old_name='description_ro_RO', - new_name='description_ro_ro', + model_name="brand", + old_name="description_ro_RO", + new_name="description_ro_ro", ), migrations.RenameField( - model_name='brand', - old_name='description_ru_RU', - new_name='description_ru_ru', + model_name="brand", + old_name="description_ru_RU", + new_name="description_ru_ru", ), migrations.RenameField( - model_name='category', - old_name='description_ar_AR', - new_name='description_ar_ar', + model_name="category", + old_name="description_ar_AR", + new_name="description_ar_ar", ), migrations.RenameField( - model_name='category', - old_name='description_cs_CZ', - new_name='description_cs_cz', + model_name="category", + old_name="description_cs_CZ", + new_name="description_cs_cz", ), migrations.RenameField( - model_name='category', - old_name='description_da_DK', - new_name='description_da_dk', + model_name="category", + old_name="description_da_DK", + new_name="description_da_dk", ), migrations.RenameField( - model_name='category', - old_name='description_de_DE', - new_name='description_de_de', + model_name="category", + old_name="description_de_DE", + new_name="description_de_de", ), migrations.RenameField( - model_name='category', - old_name='description_en_GB', - new_name='description_en_gb', + model_name="category", + old_name="description_en_GB", + new_name="description_en_gb", ), migrations.RenameField( - model_name='category', - old_name='description_en_US', - new_name='description_en_us', + model_name="category", + old_name="description_en_US", + new_name="description_en_us", ), migrations.RenameField( - model_name='category', - old_name='description_es_ES', - new_name='description_es_es', + model_name="category", + old_name="description_es_ES", + new_name="description_es_es", ), migrations.RenameField( - model_name='category', - old_name='description_fr_FR', - new_name='description_fr_fr', + model_name="category", + old_name="description_fr_FR", + new_name="description_fr_fr", ), migrations.RenameField( - model_name='category', - old_name='description_hi_IN', - new_name='description_hi_in', + model_name="category", + old_name="description_hi_IN", + new_name="description_hi_in", ), migrations.RenameField( - model_name='category', - old_name='description_it_IT', - new_name='description_it_it', + model_name="category", + old_name="description_it_IT", + new_name="description_it_it", ), migrations.RenameField( - model_name='category', - old_name='description_ja_JP', - new_name='description_ja_jp', + model_name="category", + old_name="description_ja_JP", + new_name="description_ja_jp", ), migrations.RenameField( - model_name='category', - old_name='description_kk_KZ', - new_name='description_kk_kz', + model_name="category", + old_name="description_kk_KZ", + new_name="description_kk_kz", ), migrations.RenameField( - model_name='category', - old_name='description_nl_NL', - new_name='description_nl_nl', + model_name="category", + old_name="description_nl_NL", + new_name="description_nl_nl", ), migrations.RenameField( - model_name='category', - old_name='description_pl_PL', - new_name='description_pl_pl', + model_name="category", + old_name="description_pl_PL", + new_name="description_pl_pl", ), migrations.RenameField( - model_name='category', - old_name='description_pt_BR', - new_name='description_pt_br', + model_name="category", + old_name="description_pt_BR", + new_name="description_pt_br", ), migrations.RenameField( - model_name='category', - old_name='description_ro_RO', - new_name='description_ro_ro', + model_name="category", + old_name="description_ro_RO", + new_name="description_ro_ro", ), migrations.RenameField( - model_name='category', - old_name='description_ru_RU', - new_name='description_ru_ru', + model_name="category", + old_name="description_ru_RU", + new_name="description_ru_ru", ), migrations.RenameField( - model_name='category', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="category", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='category', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="category", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='category', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="category", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='category', - old_name='name_de_DE', - new_name='name_de_de', + model_name="category", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='category', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="category", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='category', - old_name='name_en_US', - new_name='name_en_us', + model_name="category", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='category', - old_name='name_es_ES', - new_name='name_es_es', + model_name="category", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='category', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="category", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='category', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="category", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='category', - old_name='name_it_IT', - new_name='name_it_it', + model_name="category", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='category', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="category", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='category', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="category", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='category', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="category", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='category', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="category", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='category', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="category", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='category', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="category", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='category', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="category", + old_name="name_ru_RU", + new_name="name_ru_ru", ), migrations.RenameField( - model_name='product', - old_name='description_ar_AR', - new_name='description_ar_ar', + model_name="product", + old_name="description_ar_AR", + new_name="description_ar_ar", ), migrations.RenameField( - model_name='product', - old_name='description_cs_CZ', - new_name='description_cs_cz', + model_name="product", + old_name="description_cs_CZ", + new_name="description_cs_cz", ), migrations.RenameField( - model_name='product', - old_name='description_da_DK', - new_name='description_da_dk', + model_name="product", + old_name="description_da_DK", + new_name="description_da_dk", ), migrations.RenameField( - model_name='product', - old_name='description_de_DE', - new_name='description_de_de', + model_name="product", + old_name="description_de_DE", + new_name="description_de_de", ), migrations.RenameField( - model_name='product', - old_name='description_en_GB', - new_name='description_en_gb', + model_name="product", + old_name="description_en_GB", + new_name="description_en_gb", ), migrations.RenameField( - model_name='product', - old_name='description_en_US', - new_name='description_en_us', + model_name="product", + old_name="description_en_US", + new_name="description_en_us", ), migrations.RenameField( - model_name='product', - old_name='description_es_ES', - new_name='description_es_es', + model_name="product", + old_name="description_es_ES", + new_name="description_es_es", ), migrations.RenameField( - model_name='product', - old_name='description_fr_FR', - new_name='description_fr_fr', + model_name="product", + old_name="description_fr_FR", + new_name="description_fr_fr", ), migrations.RenameField( - model_name='product', - old_name='description_hi_IN', - new_name='description_hi_in', + model_name="product", + old_name="description_hi_IN", + new_name="description_hi_in", ), migrations.RenameField( - model_name='product', - old_name='description_it_IT', - new_name='description_it_it', + model_name="product", + old_name="description_it_IT", + new_name="description_it_it", ), migrations.RenameField( - model_name='product', - old_name='description_ja_JP', - new_name='description_ja_jp', + model_name="product", + old_name="description_ja_JP", + new_name="description_ja_jp", ), migrations.RenameField( - model_name='product', - old_name='description_kk_KZ', - new_name='description_kk_kz', + model_name="product", + old_name="description_kk_KZ", + new_name="description_kk_kz", ), migrations.RenameField( - model_name='product', - old_name='description_nl_NL', - new_name='description_nl_nl', + model_name="product", + old_name="description_nl_NL", + new_name="description_nl_nl", ), migrations.RenameField( - model_name='product', - old_name='description_pl_PL', - new_name='description_pl_pl', + model_name="product", + old_name="description_pl_PL", + new_name="description_pl_pl", ), migrations.RenameField( - model_name='product', - old_name='description_pt_BR', - new_name='description_pt_br', + model_name="product", + old_name="description_pt_BR", + new_name="description_pt_br", ), migrations.RenameField( - model_name='product', - old_name='description_ro_RO', - new_name='description_ro_ro', + model_name="product", + old_name="description_ro_RO", + new_name="description_ro_ro", ), migrations.RenameField( - model_name='product', - old_name='description_ru_RU', - new_name='description_ru_ru', + model_name="product", + old_name="description_ru_RU", + new_name="description_ru_ru", ), migrations.RenameField( - model_name='product', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="product", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='product', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="product", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='product', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="product", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='product', - old_name='name_de_DE', - new_name='name_de_de', + model_name="product", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='product', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="product", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='product', - old_name='name_en_US', - new_name='name_en_us', + model_name="product", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='product', - old_name='name_es_ES', - new_name='name_es_es', + model_name="product", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='product', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="product", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='product', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="product", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='product', - old_name='name_it_IT', - new_name='name_it_it', + model_name="product", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='product', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="product", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='product', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="product", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='product', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="product", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='product', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="product", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='product', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="product", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='product', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="product", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='product', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="product", + old_name="name_ru_RU", + new_name="name_ru_ru", ), migrations.RenameField( - model_name='producttag', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="producttag", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='producttag', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="producttag", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='producttag', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="producttag", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='producttag', - old_name='name_de_DE', - new_name='name_de_de', + model_name="producttag", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='producttag', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="producttag", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='producttag', - old_name='name_en_US', - new_name='name_en_us', + model_name="producttag", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='producttag', - old_name='name_es_ES', - new_name='name_es_es', + model_name="producttag", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='producttag', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="producttag", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='producttag', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="producttag", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='producttag', - old_name='name_it_IT', - new_name='name_it_it', + model_name="producttag", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='producttag', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="producttag", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='producttag', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="producttag", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='producttag', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="producttag", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='producttag', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="producttag", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='producttag', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="producttag", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='producttag', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="producttag", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='producttag', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="producttag", + old_name="name_ru_RU", + new_name="name_ru_ru", ), migrations.RenameField( - model_name='promotion', - old_name='description_ar_AR', - new_name='description_ar_ar', + model_name="promotion", + old_name="description_ar_AR", + new_name="description_ar_ar", ), migrations.RenameField( - model_name='promotion', - old_name='description_cs_CZ', - new_name='description_cs_cz', + model_name="promotion", + old_name="description_cs_CZ", + new_name="description_cs_cz", ), migrations.RenameField( - model_name='promotion', - old_name='description_da_DK', - new_name='description_da_dk', + model_name="promotion", + old_name="description_da_DK", + new_name="description_da_dk", ), migrations.RenameField( - model_name='promotion', - old_name='description_de_DE', - new_name='description_de_de', + model_name="promotion", + old_name="description_de_DE", + new_name="description_de_de", ), migrations.RenameField( - model_name='promotion', - old_name='description_en_GB', - new_name='description_en_gb', + model_name="promotion", + old_name="description_en_GB", + new_name="description_en_gb", ), migrations.RenameField( - model_name='promotion', - old_name='description_en_US', - new_name='description_en_us', + model_name="promotion", + old_name="description_en_US", + new_name="description_en_us", ), migrations.RenameField( - model_name='promotion', - old_name='description_es_ES', - new_name='description_es_es', + model_name="promotion", + old_name="description_es_ES", + new_name="description_es_es", ), migrations.RenameField( - model_name='promotion', - old_name='description_fr_FR', - new_name='description_fr_fr', + model_name="promotion", + old_name="description_fr_FR", + new_name="description_fr_fr", ), migrations.RenameField( - model_name='promotion', - old_name='description_hi_IN', - new_name='description_hi_in', + model_name="promotion", + old_name="description_hi_IN", + new_name="description_hi_in", ), migrations.RenameField( - model_name='promotion', - old_name='description_it_IT', - new_name='description_it_it', + model_name="promotion", + old_name="description_it_IT", + new_name="description_it_it", ), migrations.RenameField( - model_name='promotion', - old_name='description_ja_JP', - new_name='description_ja_jp', + model_name="promotion", + old_name="description_ja_JP", + new_name="description_ja_jp", ), migrations.RenameField( - model_name='promotion', - old_name='description_kk_KZ', - new_name='description_kk_kz', + model_name="promotion", + old_name="description_kk_KZ", + new_name="description_kk_kz", ), migrations.RenameField( - model_name='promotion', - old_name='description_nl_NL', - new_name='description_nl_nl', + model_name="promotion", + old_name="description_nl_NL", + new_name="description_nl_nl", ), migrations.RenameField( - model_name='promotion', - old_name='description_pl_PL', - new_name='description_pl_pl', + model_name="promotion", + old_name="description_pl_PL", + new_name="description_pl_pl", ), migrations.RenameField( - model_name='promotion', - old_name='description_pt_BR', - new_name='description_pt_br', + model_name="promotion", + old_name="description_pt_BR", + new_name="description_pt_br", ), migrations.RenameField( - model_name='promotion', - old_name='description_ro_RO', - new_name='description_ro_ro', + model_name="promotion", + old_name="description_ro_RO", + new_name="description_ro_ro", ), migrations.RenameField( - model_name='promotion', - old_name='description_ru_RU', - new_name='description_ru_ru', + model_name="promotion", + old_name="description_ru_RU", + new_name="description_ru_ru", ), migrations.RenameField( - model_name='promotion', - old_name='name_ar_AR', - new_name='name_ar_ar', + model_name="promotion", + old_name="name_ar_AR", + new_name="name_ar_ar", ), migrations.RenameField( - model_name='promotion', - old_name='name_cs_CZ', - new_name='name_cs_cz', + model_name="promotion", + old_name="name_cs_CZ", + new_name="name_cs_cz", ), migrations.RenameField( - model_name='promotion', - old_name='name_da_DK', - new_name='name_da_dk', + model_name="promotion", + old_name="name_da_DK", + new_name="name_da_dk", ), migrations.RenameField( - model_name='promotion', - old_name='name_de_DE', - new_name='name_de_de', + model_name="promotion", + old_name="name_de_DE", + new_name="name_de_de", ), migrations.RenameField( - model_name='promotion', - old_name='name_en_GB', - new_name='name_en_gb', + model_name="promotion", + old_name="name_en_GB", + new_name="name_en_gb", ), migrations.RenameField( - model_name='promotion', - old_name='name_en_US', - new_name='name_en_us', + model_name="promotion", + old_name="name_en_US", + new_name="name_en_us", ), migrations.RenameField( - model_name='promotion', - old_name='name_es_ES', - new_name='name_es_es', + model_name="promotion", + old_name="name_es_ES", + new_name="name_es_es", ), migrations.RenameField( - model_name='promotion', - old_name='name_fr_FR', - new_name='name_fr_fr', + model_name="promotion", + old_name="name_fr_FR", + new_name="name_fr_fr", ), migrations.RenameField( - model_name='promotion', - old_name='name_hi_IN', - new_name='name_hi_in', + model_name="promotion", + old_name="name_hi_IN", + new_name="name_hi_in", ), migrations.RenameField( - model_name='promotion', - old_name='name_it_IT', - new_name='name_it_it', + model_name="promotion", + old_name="name_it_IT", + new_name="name_it_it", ), migrations.RenameField( - model_name='promotion', - old_name='name_ja_JP', - new_name='name_ja_jp', + model_name="promotion", + old_name="name_ja_JP", + new_name="name_ja_jp", ), migrations.RenameField( - model_name='promotion', - old_name='name_kk_KZ', - new_name='name_kk_kz', + model_name="promotion", + old_name="name_kk_KZ", + new_name="name_kk_kz", ), migrations.RenameField( - model_name='promotion', - old_name='name_nl_NL', - new_name='name_nl_nl', + model_name="promotion", + old_name="name_nl_NL", + new_name="name_nl_nl", ), migrations.RenameField( - model_name='promotion', - old_name='name_pl_PL', - new_name='name_pl_pl', + model_name="promotion", + old_name="name_pl_PL", + new_name="name_pl_pl", ), migrations.RenameField( - model_name='promotion', - old_name='name_pt_BR', - new_name='name_pt_br', + model_name="promotion", + old_name="name_pt_BR", + new_name="name_pt_br", ), migrations.RenameField( - model_name='promotion', - old_name='name_ro_RO', - new_name='name_ro_ro', + model_name="promotion", + old_name="name_ro_RO", + new_name="name_ro_ro", ), migrations.RenameField( - model_name='promotion', - old_name='name_ru_RU', - new_name='name_ru_ru', + model_name="promotion", + old_name="name_ru_RU", + new_name="name_ru_ru", ), ] diff --git a/core/migrations/0022_category_slug.py b/core/migrations/0022_category_slug.py index fe1e3b26..cd887039 100644 --- a/core/migrations/0022_category_slug.py +++ b/core/migrations/0022_category_slug.py @@ -7,7 +7,7 @@ from django.db import migrations def populate_slugs(apps, schema_editor): if schema_editor: pass - Category = apps.get_model('core', 'Category') + Category = apps.get_model("core", "Category") for category in Category.objects.all(): try: if not category.slug: @@ -18,15 +18,16 @@ def populate_slugs(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('core', '0021_rename_name_ar_ar_attribute_name_ar_ar_and_more'), + ("core", "0021_rename_name_ar_ar_attribute_name_ar_ar_and_more"), ] operations = [ migrations.AddField( - model_name='category', - name='slug', - field=django_extensions.db.fields.AutoSlugField(allow_unicode=True, blank=True, editable=False, null=True, - populate_from=('uuid', 'name'), unique=True), + model_name="category", + name="slug", + field=django_extensions.db.fields.AutoSlugField( + allow_unicode=True, blank=True, editable=False, null=True, populate_from=("uuid", "name"), unique=True + ), ), migrations.RunPython(populate_slugs, reverse_code=migrations.RunPython.noop), ] diff --git a/core/migrations/0023_address_address_line.py b/core/migrations/0023_address_address_line.py index 55654c18..e1f6ebf4 100644 --- a/core/migrations/0023_address_address_line.py +++ b/core/migrations/0023_address_address_line.py @@ -5,14 +5,15 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0022_category_slug'), + ("core", "0022_category_slug"), ] operations = [ migrations.AddField( - model_name='address', - name='address_line', - field=models.TextField(blank=True, help_text='address line for the customer', null=True, - verbose_name='address line'), + model_name="address", + name="address_line", + field=models.TextField( + blank=True, help_text="address line for the customer", null=True, verbose_name="address line" + ), ), ] diff --git a/core/migrations/0024_categorytag_category_tags.py b/core/migrations/0024_categorytag_category_tags.py index 9b140e9a..71a220aa 100644 --- a/core/migrations/0024_categorytag_category_tags.py +++ b/core/migrations/0024_categorytag_category_tags.py @@ -9,95 +9,256 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0023_address_address_line'), + ("core", "0023_address_address_line"), ] operations = [ migrations.CreateModel( - name='CategoryTag', + name="CategoryTag", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('tag_name', models.CharField(help_text='internal tag identifier for the product tag', max_length=255, - verbose_name='tag name')), - ('name', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, unique=True, - verbose_name='tag display name')), - ('name_en_gb', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_ar_ar', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_cs_cz', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_da_dk', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_de_de', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_en_us', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_es_es', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_fr_fr', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_hi_in', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_it_it', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_ja_jp', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_kk_kz', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_nl_nl', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_pl_pl', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_pt_br', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_ro_ro', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_ru_ru', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), - ('name_zh_hans', - models.CharField(help_text='user-friendly name for the product tag', max_length=255, null=True, - unique=True, verbose_name='tag display name')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "tag_name", + models.CharField( + help_text="internal tag identifier for the product tag", max_length=255, verbose_name="tag name" + ), + ), + ( + "name", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_en_gb", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_ar_ar", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_cs_cz", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_da_dk", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_de_de", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_en_us", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_es_es", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_fr_fr", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_hi_in", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_it_it", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_ja_jp", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_kk_kz", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_nl_nl", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_pl_pl", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_pt_br", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_ro_ro", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_ru_ru", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), + ( + "name_zh_hans", + models.CharField( + help_text="user-friendly name for the product tag", + max_length=255, + null=True, + unique=True, + verbose_name="tag display name", + ), + ), ], options={ - 'verbose_name': 'category tag', - 'verbose_name_plural': 'category tags', + "verbose_name": "category tag", + "verbose_name_plural": "category tags", }, - bases=(django_prometheus.models.ExportModelOperationsMixin('category_tag'), models.Model), + bases=(django_prometheus.models.ExportModelOperationsMixin("category_tag"), models.Model), ), migrations.AddField( - model_name='category', - name='tags', - field=models.ManyToManyField(blank=True, help_text='tags that help describe or group this category', - to='core.categorytag', verbose_name='category tags'), + model_name="category", + name="tags", + field=models.ManyToManyField( + blank=True, + help_text="tags that help describe or group this category", + to="core.categorytag", + verbose_name="category tags", + ), ), ] diff --git a/core/migrations/0025_alter_product_category.py b/core/migrations/0025_alter_product_category.py index 4e6cc22d..f524aef9 100644 --- a/core/migrations/0025_alter_product_category.py +++ b/core/migrations/0025_alter_product_category.py @@ -6,15 +6,19 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('core', '0024_categorytag_category_tags'), + ("core", "0024_categorytag_category_tags"), ] operations = [ migrations.AlterField( - model_name='product', - name='category', - field=models.ForeignKey(help_text='category this product belongs to', - on_delete=django.db.models.deletion.CASCADE, related_name='products', - to='core.category', verbose_name='category'), + model_name="product", + name="category", + field=models.ForeignKey( + help_text="category this product belongs to", + on_delete=django.db.models.deletion.CASCADE, + related_name="products", + to="core.category", + verbose_name="category", + ), ), ] diff --git a/core/migrations/0026_brand_slug_alter_category_slug_alter_product_slug.py b/core/migrations/0026_brand_slug_alter_category_slug_alter_product_slug.py index 3a0a57b3..39905993 100644 --- a/core/migrations/0026_brand_slug_alter_category_slug_alter_product_slug.py +++ b/core/migrations/0026_brand_slug_alter_category_slug_alter_product_slug.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0025_alter_product_category"), ] diff --git a/core/migrations/0027_brand_priority_alter_brand_slug.py b/core/migrations/0027_brand_priority_alter_brand_slug.py index 0aca9c40..5427bc2c 100644 --- a/core/migrations/0027_brand_priority_alter_brand_slug.py +++ b/core/migrations/0027_brand_priority_alter_brand_slug.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("core", "0026_brand_slug_alter_category_slug_alter_product_slug"), ] diff --git a/core/migrations/0028_alter_category_slug_alter_product_slug.py b/core/migrations/0028_alter_category_slug_alter_product_slug.py index e14befd4..552057fa 100644 --- a/core/migrations/0028_alter_category_slug_alter_product_slug.py +++ b/core/migrations/0028_alter_category_slug_alter_product_slug.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0027_brand_priority_alter_brand_slug"), ] diff --git a/core/migrations/0029_alter_category_slug.py b/core/migrations/0029_alter_category_slug.py index 1c11d24d..d0ef9170 100644 --- a/core/migrations/0029_alter_category_slug.py +++ b/core/migrations/0029_alter_category_slug.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0028_alter_category_slug_alter_product_slug"), ] diff --git a/core/migrations/0030_alter_category_slug.py b/core/migrations/0030_alter_category_slug.py index b46497e8..8ad88128 100644 --- a/core/migrations/0030_alter_category_slug.py +++ b/core/migrations/0030_alter_category_slug.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0029_alter_category_slug"), ] diff --git a/core/migrations/0031_alter_product_slug.py b/core/migrations/0031_alter_product_slug.py index cebf2052..39b0fa1b 100644 --- a/core/migrations/0031_alter_product_slug.py +++ b/core/migrations/0031_alter_product_slug.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0030_alter_category_slug"), ] diff --git a/core/migrations/0032_alter_brand_slug_alter_category_slug_and_more.py b/core/migrations/0032_alter_brand_slug_alter_category_slug_and_more.py index 237c5935..eb6005ab 100644 --- a/core/migrations/0032_alter_brand_slug_alter_category_slug_and_more.py +++ b/core/migrations/0032_alter_brand_slug_alter_category_slug_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0031_alter_product_slug"), ] diff --git a/core/migrations/0033_alter_category_slug.py b/core/migrations/0033_alter_category_slug.py index 034beed6..a022aba5 100644 --- a/core/migrations/0033_alter_category_slug.py +++ b/core/migrations/0033_alter_category_slug.py @@ -6,7 +6,6 @@ import core.utils.db class Migration(migrations.Migration): - dependencies = [ ("core", "0032_alter_brand_slug_alter_category_slug_and_more"), ] diff --git a/core/migrations/0034_category_priority_alter_brand_priority.py b/core/migrations/0034_category_priority_alter_brand_priority.py index cd64f3f1..08c161fe 100644 --- a/core/migrations/0034_category_priority_alter_brand_priority.py +++ b/core/migrations/0034_category_priority_alter_brand_priority.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("core", "0033_alter_category_slug"), ] diff --git a/core/migrations/0035_alter_brand_slug_alter_category_slug_and_more.py b/core/migrations/0035_alter_brand_slug_alter_category_slug_and_more.py index 5653f575..16a5702d 100644 --- a/core/migrations/0035_alter_brand_slug_alter_category_slug_and_more.py +++ b/core/migrations/0035_alter_brand_slug_alter_category_slug_and_more.py @@ -6,7 +6,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("core", "0034_category_priority_alter_brand_priority"), ] diff --git a/core/models.py b/core/models.py index 2dfb79dc..f1d326b6 100644 --- a/core/models.py +++ b/core/models.py @@ -1,7 +1,6 @@ import datetime import json import logging -from decimal import Decimal from typing import Optional, Self from constance import config @@ -29,6 +28,7 @@ from django.db.models import ( OneToOneField, PositiveIntegerField, TextField, + QuerySet, ) from django.db.models.indexes import Index from django.http import Http404 @@ -59,7 +59,7 @@ from payments.models import Transaction logger = logging.getLogger("evibes") -class AttributeGroup(ExportModelOperationsMixin("attribute_group"), NiceModel): +class AttributeGroup(ExportModelOperationsMixin("attribute_group"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a group of attributes, which can be hierarchical. @@ -85,8 +85,10 @@ class AttributeGroup(ExportModelOperationsMixin("attribute_group"), NiceModel): """ is_publicly_visible = True + attributes: QuerySet["Attribute"] + children: QuerySet["Self"] - parent: Self = ForeignKey( # type: ignore + parent = ForeignKey( "self", on_delete=CASCADE, null=True, @@ -95,7 +97,7 @@ class AttributeGroup(ExportModelOperationsMixin("attribute_group"), NiceModel): help_text=_("parent of this group"), verbose_name=_("parent attribute group"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, verbose_name=_("attribute group's name"), help_text=_("attribute group's name"), @@ -110,7 +112,7 @@ class AttributeGroup(ExportModelOperationsMixin("attribute_group"), NiceModel): verbose_name_plural = _("attribute groups") -class Vendor(ExportModelOperationsMixin("vendor"), NiceModel): +class Vendor(ExportModelOperationsMixin("vendor"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a vendor entity capable of storing information about external vendors and their interaction requirements. @@ -141,19 +143,19 @@ class Vendor(ExportModelOperationsMixin("vendor"), NiceModel): is_publicly_visible = False - authentication: dict = JSONField( # type: ignore + authentication = JSONField( blank=True, null=True, help_text=_("stores credentials and endpoints required for vendor communication"), verbose_name=_("authentication info"), ) - markup_percent: int = IntegerField( # type: ignore + markup_percent = IntegerField( default=0, validators=[MinValueValidator(0), MaxValueValidator(100)], help_text=_("define the markup for products retrieved from this vendor"), verbose_name=_("vendor markup percentage"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("name of this vendor"), verbose_name=_("vendor name"), @@ -173,7 +175,7 @@ class Vendor(ExportModelOperationsMixin("vendor"), NiceModel): ] -class ProductTag(ExportModelOperationsMixin("product_tag"), NiceModel): +class ProductTag(ExportModelOperationsMixin("product_tag"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a product tag used for classifying or identifying products. @@ -192,14 +194,14 @@ class ProductTag(ExportModelOperationsMixin("product_tag"), NiceModel): is_publicly_visible = True - tag_name: str = CharField( # type: ignore + tag_name = CharField( blank=False, null=False, max_length=255, help_text=_("internal tag identifier for the product tag"), verbose_name=_("tag name"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("user-friendly name for the product tag"), verbose_name=_("tag display name"), @@ -214,7 +216,7 @@ class ProductTag(ExportModelOperationsMixin("product_tag"), NiceModel): verbose_name_plural = _("product tags") -class CategoryTag(ExportModelOperationsMixin("category_tag"), NiceModel): +class CategoryTag(ExportModelOperationsMixin("category_tag"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a category tag used for products. @@ -230,14 +232,14 @@ class CategoryTag(ExportModelOperationsMixin("category_tag"), NiceModel): is_publicly_visible = True - tag_name: str = CharField( # type: ignore + tag_name = CharField( blank=False, null=False, max_length=255, help_text=_("internal tag identifier for the product tag"), verbose_name=_("tag name"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("user-friendly name for the product tag"), verbose_name=_("tag display name"), @@ -252,7 +254,7 @@ class CategoryTag(ExportModelOperationsMixin("category_tag"), NiceModel): verbose_name_plural = _("category tags") -class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): +class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): # type: ignore [misc, django-manager-missing] """ Represents a category entity to organize and group related items in a hierarchical structure. Categories may have hierarchical relationships with other categories, @@ -266,36 +268,36 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): Attributes ---------- - is_publicly_visible : bool + is_publicly_visible A flag indicating whether the category is visible to the public. image : ImageField Represents an optional image associated with the category. The image is used to visually represent the category. - markup_percent : int + markup_percent Specifies the markup percentage for products in this category. It is validated to ensure values fall between 0 and 100. - parent : Self + parent Represents the parent category in a hierarchical structure. This forms category relationships to enable nesting. - name : str + name The name of the category, which also must be unique. This serves as the primary identifier for the category. - description : str + description An optional detailed description explaining the purpose or details of the category. - slug : str + slug A unique, auto-generated field created from the category's name and parent name, suitable for use in URLs and identifying the category. - tags : CategoryTag + tags Optional tags used to group or describe the category better. - priority : int + priority Represents the priority of the category, which could be used for sorting or rendering purposes. @@ -308,12 +310,11 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): Computes the depth of the category in the hierarchical structure. It determines the maximum depth of its descendants or returns zero if the category is a leaf. - Meta Options ------------ - verbose_name : str + verbose_name Specifies the singular human-readable name for the category model. - verbose_name_plural : str + verbose_name_plural Specifies the plural human-readable name for the category model. ordering : list @@ -323,7 +324,7 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): is_publicly_visible = True - image = ImageField( # type: ignore + image = ImageField( blank=True, null=True, help_text=_("upload an image representing this category"), @@ -331,13 +332,13 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): validators=[validate_category_image_dimensions], verbose_name=_("category image"), ) - markup_percent: int = IntegerField( # type: ignore + markup_percent = IntegerField( default=0, validators=[MinValueValidator(0), MaxValueValidator(100)], help_text=_("define a markup percentage for products in this category"), verbose_name=_("markup percentage"), ) - parent: Self = TreeForeignKey( + parent = TreeForeignKey( "self", on_delete=CASCADE, blank=True, @@ -347,21 +348,21 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): verbose_name=_("parent category"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, verbose_name=_("category name"), help_text=_("provide a name for this category"), unique=True, ) - description: str = TextField( # type: ignore + description = TextField( blank=True, null=True, help_text=_("add a detailed description for this category"), verbose_name=_("category description"), ) - slug: str = TweakedAutoSlugField( # type: ignore + slug = TweakedAutoSlugField( populate_from=( "parent__name", "name", @@ -375,13 +376,13 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): null=True, verbose_name=_("Slug"), ) - tags: CategoryTag = ManyToManyField( # type: ignore + tags = ManyToManyField( "core.CategoryTag", blank=True, help_text=_("tags that help describe or group this category"), verbose_name=_("category tags"), ) - priority: int = PositiveIntegerField( # type: ignore + priority = PositiveIntegerField( default=0, null=False, blank=False, @@ -402,7 +403,7 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel): ordering = ["tree_id", "lft"] -class Brand(ExportModelOperationsMixin("brand"), NiceModel): +class Brand(ExportModelOperationsMixin("brand"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a Brand object in the system. @@ -424,13 +425,13 @@ class Brand(ExportModelOperationsMixin("brand"), NiceModel): is_publicly_visible = True - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("name of this brand"), verbose_name=_("brand name"), unique=True, ) - small_logo = ImageField( # type: ignore + small_logo = ImageField( upload_to="brands/", blank=True, null=True, @@ -438,7 +439,7 @@ class Brand(ExportModelOperationsMixin("brand"), NiceModel): validators=[validate_category_image_dimensions], verbose_name=_("brand small image"), ) - big_logo = ImageField( # type: ignore + big_logo = ImageField( upload_to="brands/", blank=True, null=True, @@ -446,19 +447,19 @@ class Brand(ExportModelOperationsMixin("brand"), NiceModel): validators=[validate_category_image_dimensions], verbose_name=_("brand big image"), ) - description: str = TextField( # type: ignore + description = TextField( blank=True, null=True, help_text=_("add a detailed description of the brand"), verbose_name=_("brand description"), ) - categories: Category = ManyToManyField( # type: ignore + categories = ManyToManyField( "core.Category", blank=True, help_text=_("optional categories that this brand is associated with"), verbose_name=_("associated categories"), ) - slug: str = AutoSlugField( # type: ignore + slug = AutoSlugField( populate_from=("name",), allow_unicode=True, unique=True, @@ -469,7 +470,7 @@ class Brand(ExportModelOperationsMixin("brand"), NiceModel): slugify_function=unicode_slugify_function, verbose_name=_("Slug"), ) - priority: int = PositiveIntegerField( # type: ignore + priority = PositiveIntegerField( default=0, null=False, blank=False, @@ -484,7 +485,82 @@ class Brand(ExportModelOperationsMixin("brand"), NiceModel): verbose_name_plural = _("brands") -class Product(ExportModelOperationsMixin("product"), NiceModel): +class Stock(ExportModelOperationsMixin("stock"), NiceModel): # type: ignore [misc, django-manager-missing] + """ + Represents the stock of a product managed in the system. + + This class provides details about the relationship between vendors, products, + and their stock information, as well as inventory-related properties like price, + purchase price, quantity, SKU, and digital assets. It is part of the inventory + management system to allow tracking and evaluation of products available from + various vendors. + + Attributes: + is_publicly_visible (bool): Indicates if the stock is publicly visible. Defaults to False. + vendor (ForeignKey): The vendor supplying this product stock. + price (float): The final price to the customer after markups. + product (ForeignKey): The product associated with this stock entry. + purchase_price (float): The price paid to the vendor for this product. + quantity (int): Available quantity of the product in stock. + sku (str): Vendor-assigned SKU for identifying the product. + digital_asset (FileField): Digital file associated with this stock if applicable. + """ + + is_publicly_visible = False + + vendor = ForeignKey( + "core.Vendor", + on_delete=CASCADE, + help_text=_("the vendor supplying this product stock"), + verbose_name=_("associated vendor"), + ) + price = FloatField( + default=0.0, + help_text=_("final price to the customer after markups"), + verbose_name=_("selling price"), + ) + product = ForeignKey( + "core.Product", + on_delete=CASCADE, + help_text=_("the product associated with this stock entry"), + verbose_name=_("associated product"), + related_name="stocks", + blank=True, + null=True, + ) + purchase_price = FloatField( + default=0.0, + help_text=_("the price paid to the vendor for this product"), + verbose_name=_("vendor purchase price"), + ) + quantity = IntegerField( + default=0, + help_text=_("available quantity of the product in stock"), + verbose_name=_("quantity in stock"), + ) + sku = CharField( + max_length=255, + help_text=_("vendor-assigned SKU for identifying the product"), + verbose_name=_("vendor sku"), + ) + digital_asset = FileField( + default=None, + blank=True, + null=True, + help_text=_("digital file associated with this stock if applicable"), + verbose_name=_("digital file"), + upload_to="downloadables/", + ) + + def __str__(self) -> str: + return f"{self.vendor.name} - {self.product!s}" + + class Meta: + verbose_name = _("stock") + verbose_name_plural = _("stock entries") + + +class Product(ExportModelOperationsMixin("product"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a product with attributes such as category, brand, tags, digital status, name, description, part number, and slug. Provides related utility properties to retrieve @@ -522,14 +598,14 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): is_publicly_visible = True - category: Category = ForeignKey( # type: ignore + category = ForeignKey( "core.Category", on_delete=CASCADE, help_text=_("category this product belongs to"), verbose_name=_("category"), related_name="products", ) - brand: Brand = ForeignKey( # type: ignore + brand = ForeignKey( "core.Brand", on_delete=CASCADE, blank=True, @@ -537,31 +613,31 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): help_text=_("optionally associate this product with a brand"), verbose_name=_("brand"), ) - tags: ProductTag = ManyToManyField( # type: ignore + tags = ManyToManyField( "core.ProductTag", blank=True, help_text=_("tags that help describe or group this product"), verbose_name=_("product tags"), ) - is_digital: bool = BooleanField( # type: ignore + is_digital = BooleanField( default=False, help_text=_("indicates whether this product is digitally delivered"), verbose_name=_("is product digital"), blank=False, null=False, ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("provide a clear identifying name for the product"), verbose_name=_("product name"), ) - description: str = TextField( # type: ignore + description = TextField( blank=True, null=True, help_text=_("add a detailed description of the product"), verbose_name=_("product description"), ) - partnumber: str = CharField( # type: ignore + partnumber = CharField( unique=True, default=None, blank=False, @@ -569,7 +645,7 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): help_text=_("part number for this product"), verbose_name=_("part number"), ) - slug: str | None = AutoSlugField( # type: ignore + slug = AutoSlugField( populate_from=( "name", "brand__slug", @@ -617,8 +693,8 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): return feedbacks_count @property - def price(self) -> float: - stock = self.stocks.order_by("price").only("price").first() + def price(self: Self) -> float: + stock = self.stocks.all().order_by("-price").only("price").first() price = stock.price if stock else 0.0 return round(price, 2) @@ -641,7 +717,7 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): ).count() -class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): +class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents an attribute in the system. @@ -657,7 +733,7 @@ class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): visible. Defaults to True. categories (ManyToManyField): Categories to which this attribute - belongs. It is a many-to-many relationship with `Category` model. + belongs. It is a many-to-many relationship with the `Category` model. group (ForeignKey): The group to which this attribute belongs. It is a ForeignKey relation to the `AttributeGroup` model. @@ -670,21 +746,21 @@ class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): is_publicly_visible = True - categories: Category = ManyToManyField( # type: ignore + categories = ManyToManyField( "core.Category", related_name="attributes", help_text=_("category of this attribute"), verbose_name=_("categories"), ) - group: AttributeGroup = ForeignKey( # type: ignore + group = ForeignKey( "core.AttributeGroup", on_delete=CASCADE, related_name="attributes", help_text=_("group of this attribute"), verbose_name=_("attribute group"), ) - value_type: str = CharField( # type: ignore + value_type = CharField( max_length=50, choices=[ ("string", _("string")), @@ -698,7 +774,7 @@ class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): verbose_name=_("value type"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=255, help_text=_("name of this attribute"), verbose_name=_("attribute's name"), @@ -713,7 +789,7 @@ class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): verbose_name_plural = _("attributes") -class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): +class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a specific value for an attribute that is linked to a product. @@ -725,7 +801,7 @@ class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): Attributes ---------- - is_publicly_visible : bool + is_publicly_visible Determines if the attribute value is visible publicly. Defaults to True. attribute : core.Attribute The 'Attribute' object this value is linked to. Foreign key relationship @@ -733,20 +809,20 @@ class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): product : core.Product The specific 'Product' this attribute's value is associated with. Foreign key relationship with 'core.Product'. - value : str + value Holds the specific value for this attribute as a text field. """ is_publicly_visible = True - attribute: Attribute = ForeignKey( # type: ignore + attribute = ForeignKey( "core.Attribute", on_delete=CASCADE, related_name="values", help_text=_("attribute of this value"), verbose_name=_("attribute"), ) - product: Product = ForeignKey( # type: ignore + product = ForeignKey( "core.Product", on_delete=CASCADE, blank=False, @@ -755,7 +831,7 @@ class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): verbose_name=_("associated product"), related_name="attributes", ) - value: str = TextField( # type: ignore + value = TextField( verbose_name=_("attribute value"), help_text=_("the specific value for this attribute"), ) @@ -768,7 +844,7 @@ class AttributeValue(ExportModelOperationsMixin("attribute_value"), NiceModel): verbose_name_plural = _("attribute values") -class ProductImage(ExportModelOperationsMixin("product_image"), NiceModel): +class ProductImage(ExportModelOperationsMixin("product_image"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a product image associated with a product in the system. @@ -789,7 +865,7 @@ class ProductImage(ExportModelOperationsMixin("product_image"), NiceModel): is_publicly_visible = True - alt: str = CharField( # type: ignore + alt = CharField( max_length=255, help_text=_("provide alternative text for the image for accessibility"), verbose_name=_("image alt text"), @@ -799,13 +875,13 @@ class ProductImage(ExportModelOperationsMixin("product_image"), NiceModel): verbose_name=_("product image"), upload_to=get_product_uuid_as_path, ) - priority: int = IntegerField( # type: ignore + priority = IntegerField( default=1, validators=[MinValueValidator(1)], help_text=_("determines the order in which images are displayed"), verbose_name=_("display priority"), ) - product: ForeignKey = ForeignKey( + product = ForeignKey( "core.Product", on_delete=CASCADE, help_text=_("the product that this image represents"), @@ -825,7 +901,7 @@ class ProductImage(ExportModelOperationsMixin("product_image"), NiceModel): verbose_name_plural = _("product images") -class Promotion(ExportModelOperationsMixin("promotion"), NiceModel): +class Promotion(ExportModelOperationsMixin("promotion"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a promotional campaign for products with a discount. @@ -841,10 +917,10 @@ class Promotion(ExportModelOperationsMixin("promotion"), NiceModel): discount_percent: IntegerField. Specifies the percentage discount for the selected products. Must be between 1 and 100 inclusive. name: CharField. A unique name for the promotion, required for promoting - distinguishable campaigns. Maximum length is 256 characters. + distinguishable campaigns. The maximum length is 256 characters. description: TextField, optional. Provides a detailed description of the promotion. Can be left blank or null. - products: ManyToManyField. Links the promotion to the products that are included + products. Links the promotion to the products that are included in its scope. Can be left blank. Meta: @@ -861,24 +937,24 @@ class Promotion(ExportModelOperationsMixin("promotion"), NiceModel): is_publicly_visible = True - discount_percent: int = IntegerField( # type: ignore + discount_percent = IntegerField( validators=[MinValueValidator(1), MaxValueValidator(100)], help_text=_("percentage discount for the selected products"), verbose_name=_("discount percentage"), ) - name: str = CharField( # type: ignore + name = CharField( max_length=256, unique=True, help_text=_("provide a unique name for this promotion"), verbose_name=_("promotion name"), ) - description: str = TextField( # type: ignore + description = TextField( blank=True, null=True, help_text=_("add a detailed description of the product"), verbose_name=_("promotion description"), ) - products: ManyToManyField = ManyToManyField( # type: ignore + products = ManyToManyField( "core.Product", blank=True, help_text=_("select which products are included in this promotion"), @@ -895,82 +971,7 @@ class Promotion(ExportModelOperationsMixin("promotion"), NiceModel): return str(self.id) -class Stock(ExportModelOperationsMixin("stock"), NiceModel): - """ - Represents the stock of a product managed in the system. - - This class provides details about the relationship between vendors, products, - and their stock information, as well as inventory-related properties like price, - purchase price, quantity, SKU, and digital assets. It is part of the inventory - management system to allow tracking and evaluation of products available from - various vendors. - - Attributes: - is_publicly_visible (bool): Indicates if the stock is publicly visible. Defaults to False. - vendor (ForeignKey): The vendor supplying this product stock. - price (float): The final price to the customer after markups. - product (ForeignKey): The product associated with this stock entry. - purchase_price (float): The price paid to the vendor for this product. - quantity (int): Available quantity of the product in stock. - sku (str): Vendor-assigned SKU for identifying the product. - digital_asset (FileField): Digital file associated with this stock if applicable. - """ - - is_publicly_visible = False - - vendor: ForeignKey = ForeignKey( - "core.Vendor", - on_delete=CASCADE, - help_text=_("the vendor supplying this product stock"), - verbose_name=_("associated vendor"), - ) - price: float = FloatField( # type: ignore - default=0.0, - help_text=_("final price to the customer after markups"), - verbose_name=_("selling price"), - ) - product: ForeignKey = ForeignKey( # type: ignore - "core.Product", - on_delete=CASCADE, - help_text=_("the product associated with this stock entry"), - verbose_name=_("associated product"), - related_name="stocks", - blank=True, - null=True, - ) - purchase_price: float = FloatField( # type: ignore - default=0.0, - help_text=_("the price paid to the vendor for this product"), - verbose_name=_("vendor purchase price"), - ) - quantity: int = IntegerField( # type: ignore - default=0, - help_text=_("available quantity of the product in stock"), - verbose_name=_("quantity in stock"), - ) - sku: str = CharField( # type: ignore - max_length=255, - help_text=_("vendor-assigned SKU for identifying the product"), - verbose_name=_("vendor sku"), - ) - digital_asset = FileField( - default=None, - blank=True, - null=True, - help_text=_("digital file associated with this stock if applicable"), - verbose_name=_("digital file"), - upload_to="downloadables/", - ) - - def __str__(self) -> str: - return f"{self.vendor.name} - {self.product!s}" # type: ignore - - class Meta: - verbose_name = _("stock") - verbose_name_plural = _("stock entries") - - -class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): +class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a user's wishlist for storing and managing desired products. @@ -983,13 +984,13 @@ class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): is_publicly_visible = False - products: ManyToManyField = ManyToManyField( # type: ignore + products = ManyToManyField( "core.Product", blank=True, help_text=_("products that the user has marked as wanted"), verbose_name=_("wishlisted products"), ) - user: OneToOneField = OneToOneField( # type: ignore + user = OneToOneField( "vibes_auth.User", on_delete=CASCADE, blank=True, @@ -1012,9 +1013,9 @@ class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): if product in self.products.all(): return self self.products.add(product) - except Product.DoesNotExist: + except Product.DoesNotExist as dne: name = "Product" - raise Http404(_(f"{name} does not exist: {product_uuid}")) + raise Http404(_(f"{name} does not exist: {product_uuid}")) from dne return self @@ -1024,9 +1025,9 @@ class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): if product not in self.products.all(): return self self.products.remove(product) - except Product.DoesNotExist: + except Product.DoesNotExist as dne: name = "Product" - raise Http404(_(f"{name} does not exist: {product_uuid}")) + raise Http404(_(f"{name} does not exist: {product_uuid}")) from dne return self @@ -1041,7 +1042,7 @@ class Wishlist(ExportModelOperationsMixin("wishlist"), NiceModel): return self -class Documentary(ExportModelOperationsMixin("attribute_group"), NiceModel): +class Documentary(ExportModelOperationsMixin("attribute_group"), NiceModel): # type: ignore [misc, django-manager-missing] """ Model representing a documentary record tied to a product. @@ -1054,7 +1055,7 @@ class Documentary(ExportModelOperationsMixin("attribute_group"), NiceModel): Attributes: is_publicly_visible: A boolean indicating if the documentary is publicly visible. - product: ForeignKey linking the documentary to a product. + product linking the documentary to a product. document: FileField used to store the file associated with the documentary. Meta: @@ -1064,7 +1065,7 @@ class Documentary(ExportModelOperationsMixin("attribute_group"), NiceModel): is_publicly_visible = True - product: ForeignKey = ForeignKey(to=Product, on_delete=CASCADE, related_name="documentaries") + product = ForeignKey(to=Product, on_delete=CASCADE, related_name="documentaries") document = FileField(upload_to=get_product_uuid_as_path) class Meta: @@ -1082,7 +1083,7 @@ class Documentary(ExportModelOperationsMixin("attribute_group"), NiceModel): return self.document.name.split(".")[-1] or _("unresolved") -class Address(ExportModelOperationsMixin("address"), NiceModel): +class Address(ExportModelOperationsMixin("address"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents an address entity that includes location details and associations with a user. Provides functionality for geographic and address data storage, as well @@ -1122,20 +1123,20 @@ class Address(ExportModelOperationsMixin("address"), NiceModel): is_publicly_visible = False - address_line: str = TextField( # type: ignore + address_line = TextField( blank=True, null=True, help_text=_("address line for the customer"), verbose_name=_("address line"), ) - street: str = CharField(_("street"), max_length=255, null=True) # type: ignore - district: str = CharField(_("district"), max_length=255, null=True) # type: ignore - city: str = CharField(_("city"), max_length=100, null=True) # type: ignore - region: str = CharField(_("region"), max_length=100, null=True) # type: ignore - postal_code: str = CharField(_("postal code"), max_length=20, null=True) # type: ignore - country: str = CharField(_("country"), max_length=40, null=True) # type: ignore + street = CharField(_("street"), max_length=255, null=True) + district = CharField(_("district"), max_length=255, null=True) + city = CharField(_("city"), max_length=100, null=True) + region = CharField(_("region"), max_length=100, null=True) + postal_code = CharField(_("postal code"), max_length=20, null=True) + country = CharField(_("country"), max_length=40, null=True) - location: PointField = PointField( # type: ignore + location: PointField = PointField( geography=True, srid=4326, null=True, @@ -1143,15 +1144,15 @@ class Address(ExportModelOperationsMixin("address"), NiceModel): help_text=_("geolocation point: (longitude, latitude)"), ) - raw_data: dict = JSONField(blank=True, null=True, help_text=_("full JSON response from geocoder for this address")) # type: ignore + raw_data = JSONField(blank=True, null=True, help_text=_("full JSON response from geocoder for this address")) - api_response: dict = JSONField( # type: ignore + api_response = JSONField( blank=True, null=True, help_text=_("stored JSON response from the geocoding service"), ) - user: ForeignKey = ForeignKey(to="vibes_auth.User", on_delete=CASCADE, blank=True, null=True) # type: ignore + user = ForeignKey(to="vibes_auth.User", on_delete=CASCADE, blank=True, null=True) objects = AddressManager() @@ -1167,7 +1168,7 @@ class Address(ExportModelOperationsMixin("address"), NiceModel): return f"{base} for {self.user.email}" if self.user else base -class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): +class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a promotional code that can be used for discounts, managing its validity, type of discount, and application. @@ -1189,7 +1190,7 @@ class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): Methods: save(**kwargs): Ensures only one type of discount (amount or percent) is defined. __str__(): Returns the promo code identifier as its string representation. - use(order): Applies the promo code to the given order and calculates final price. + use(order): Applies the promo code to the given order and calculates the final price. Meta: verbose_name: Display name for the promo code model. @@ -1198,14 +1199,14 @@ class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): is_publicly_visible = False - code: str = CharField( # type: ignore + code = CharField( max_length=20, unique=True, default=get_random_code, help_text=_("unique code used by a user to redeem a discount"), verbose_name=_("promo code identifier"), ) - discount_amount: Decimal = DecimalField( # type: ignore + discount_amount = DecimalField( max_digits=10, decimal_places=2, blank=True, @@ -1213,32 +1214,32 @@ class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): help_text=_("fixed discount amount applied if percent is not used"), verbose_name=_("fixed discount amount"), ) - discount_percent: int = IntegerField( # type: ignore + discount_percent = IntegerField( validators=[MinValueValidator(1), MaxValueValidator(100)], blank=True, null=True, help_text=_("percentage discount applied if fixed amount is not used"), verbose_name=_("percentage discount"), ) - end_time: datetime = DateTimeField( # type: ignore + end_time = DateTimeField( blank=True, null=True, help_text=_("timestamp when the promocode expires"), verbose_name=_("end validity time"), ) - start_time: datetime = DateTimeField( # type: ignore + start_time = DateTimeField( blank=True, null=True, help_text=_("timestamp from which this promocode is valid"), verbose_name=_("start validity time"), ) - used_on: datetime = DateTimeField( # type: ignore + used_on = DateTimeField( blank=True, null=True, help_text=_("timestamp when the promocode was used, blank if not used yet"), verbose_name=_("usage timestamp"), ) - user: ForeignKey = ForeignKey( # type: ignore + user = ForeignKey( "vibes_auth.User", on_delete=CASCADE, help_text=_("user assigned to this promocode if applicable"), @@ -1270,29 +1271,29 @@ class PromoCode(ExportModelOperationsMixin("promocode"), NiceModel): return "amount" return "percent" - def use(self, order: "Order") -> float: + def use(self, order) -> float: if self.used_on: raise ValueError(_("promocode already used")) - amount = order.total_price + promo_amount = order.total_price if self.discount_type == "percent": - amount -= round(amount * (self.discount_percent / 100), 2) - order.attributes.update({"promocode": str(self.uuid), "final_price": amount}) + promo_amount -= round(promo_amount * (float(self.discount_percent) / 100), 2) + order.attributes.update({"promocode": str(self.uuid), "final_price": promo_amount}) order.save() elif self.discount_type == "amount": - amount -= round(float(self.discount_amount), 2) - order.attributes.update({"promocode": str(self.uuid), "final_price": amount}) + promo_amount -= round(float(self.discount_amount), 2) + order.attributes.update({"promocode": str(self.uuid), "final_price": promo_amount}) order.save() else: raise ValueError(_(f"invalid discount type for promocode {self.uuid}")) self.used_on = datetime.datetime.now() self.save() - return amount + return promo_amount -class Order(ExportModelOperationsMixin("order"), NiceModel): +class Order(ExportModelOperationsMixin("order"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents an order placed by a user. @@ -1315,7 +1316,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): is_publicly_visible = False - billing_address: Address = ForeignKey( # type: ignore + billing_address = ForeignKey( "core.Address", on_delete=CASCADE, blank=True, @@ -1324,7 +1325,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): help_text=_("the billing address used for this order"), verbose_name=_("billing address"), ) - promo_code: PromoCode = ForeignKey( # type: ignore + promo_code = ForeignKey( "core.PromoCode", on_delete=PROTECT, blank=True, @@ -1332,7 +1333,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): help_text=_("optional promo code applied to this order"), verbose_name=_("applied promo code"), ) - shipping_address: Address = ForeignKey( # type: ignore + shipping_address = ForeignKey( "core.Address", on_delete=CASCADE, blank=True, @@ -1341,26 +1342,26 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): help_text=_("the shipping address used for this order"), verbose_name=_("shipping address"), ) - status: str = CharField( # type: ignore + status = CharField( default="PENDING", max_length=64, choices=ORDER_STATUS_CHOICES, help_text=_("current status of the order in its lifecycle"), verbose_name=_("order status"), ) - notifications: dict = JSONField( # type: ignore + notifications = JSONField( blank=True, null=True, help_text=_("json structure of notifications to display to users"), verbose_name=_("notifications"), ) - attributes: dict = JSONField( # type: ignore + attributes = JSONField( blank=True, null=True, help_text=_("json representation of order attributes for this order"), verbose_name=_("attributes"), ) - user = ForeignKey( # type: ignore + user = ForeignKey( "vibes_auth.User", on_delete=CASCADE, help_text=_("the user who placed the order"), @@ -1369,14 +1370,14 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): blank=True, null=True, ) - buy_time: datetime = DateTimeField( # type: ignore + buy_time = DateTimeField( help_text=_("the timestamp when the order was finalized"), verbose_name=_("buy time"), default=None, null=True, blank=True, ) - human_readable_id: str = CharField( # type: ignore + human_readable_id = CharField( max_length=8, help_text=_("a human-readable identifier for the order"), verbose_name=_("human readable id"), @@ -1389,7 +1390,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): verbose_name_plural = _("orders") def __str__(self) -> str: - return f"#{self.pk} for {self.user.email if self.user else 'unregistered user'}" # type: ignore + return f"#{self.pk} for {self.user.email if self.user else 'unregistered user'}" @property def is_business(self) -> bool: @@ -1426,9 +1427,9 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): def add_product( self, - product_uuid: str | None = None, + product_uuid=None, attributes: list | None = None, - update_quantity: bool = True, + update_quantity=True, ): if attributes is None: attributes = [] @@ -1446,7 +1447,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): promotions = Promotion.objects.filter(is_active=True, products__in=[product]).order_by("discount_percent") if promotions.exists(): - buy_price -= round(product.price * (promotions.first().discount_percent / 100), 2) # type: ignore + buy_price -= round(product.price * (promotions.first().discount_percent / 100), 2) order_product, is_created = OrderProduct.objects.get_or_create( product=product, @@ -1463,15 +1464,15 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): return self - except Product.DoesNotExist: + except Product.DoesNotExist as dne: name = "Product" - raise Http404(_(f"{name} does not exist: {product_uuid}")) + raise Http404(_(f"{name} does not exist: {product_uuid}")) from dne def remove_product( self, - product_uuid: str | None = None, - attributes: dict | None = None, - zero_quantity: bool = False, + product_uuid=None, + attributes=None, + zero_quantity=False, ): if attributes is None: attributes = {} @@ -1491,13 +1492,13 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): order_product.quantity -= 1 order_product.save() return self - except Product.DoesNotExist: + except Product.DoesNotExist as dne: name = "Product" - raise Http404(_(f"{name} does not exist: {product_uuid}")) - except OrderProduct.DoesNotExist: + raise Http404(_(f"{name} does not exist: {product_uuid}")) from dne + except OrderProduct.DoesNotExist as dne: name = "OrderProduct" query = f"product: {product_uuid}, order: {self.uuid}, attributes: {attributes}" - raise Http404(_(f"{name} does not exist with query <{query}>")) + raise Http404(_(f"{name} does not exist with query <{query}>")) from dne def remove_all_products(self): if self.status not in ["PENDING", "MOMENTAL"]: @@ -1507,7 +1508,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): order_product.delete() return self - def remove_products_of_a_kind(self, product_uuid: str): + def remove_products_of_a_kind(self, product_uuid): if self.status not in ["PENDING", "MOMENTAL"]: raise ValueError(_("you cannot remove products from an order that is not a pending one")) try: @@ -1515,20 +1516,20 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): order_product = self.order_products.get(product=product, order=self) self.order_products.remove(order_product) order_product.delete() - except Product.DoesNotExist: + except Product.DoesNotExist as dne: name = "Product" - raise Http404(_(f"{name} does not exist: {product_uuid}")) + raise Http404(_(f"{name} does not exist: {product_uuid}")) from dne return self @property def is_whole_digital(self): return self.order_products.count() == self.order_products.filter(product__is_digital=True).count() - def apply_promocode(self, promocode_uuid: str): + def apply_promocode(self, promocode_uuid): try: - promocode: PromoCode = PromoCode.objects.get(uuid=promocode_uuid) - except PromoCode.DoesNotExist: - raise Http404(_("promocode does not exist")) + promocode = PromoCode.objects.get(uuid=promocode_uuid) + except PromoCode.DoesNotExist as dne: + raise Http404(_("promocode does not exist")) from dne return promocode.use(self) def apply_addresses(self, billing_address_uuid, shipping_address_uuid): @@ -1555,16 +1556,16 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): self.shipping_address = shipping_address self.save() - except Address.DoesNotExist: - raise Http404(_("address does not exist")) + except Address.DoesNotExist as dne: + raise Http404(_("address does not exist")) from dne def buy( self, - force_balance: bool = False, - force_payment: bool = False, - promocode_uuid: str | None = None, - billing_address: str | None = None, - shipping_address: str | None = None, + force_balance=False, + force_payment=False, + promocode_uuid=None, + billing_address=None, + shipping_address=None, ) -> Self | Transaction | None: if config.DISABLED_COMMERCE: raise DisabledCommerceError(_("you can not buy at this moment, please try again in a few minutes")) @@ -1589,7 +1590,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): match force: case "balance": - if self.user.payments_balance.amount < amount: # type: ignore + if self.user.payments_balance.amount < amount: raise NotEnoughMoneyError(_("insufficient funds to complete the order")) self.status = "CREATED" self.buy_time = timezone.now() @@ -1600,7 +1601,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): self.status = "PAYMENT" self.save() return Transaction.objects.create( - balance=self.user.payments_balance, # type: ignore + balance=self.user.payments_balance, amount=amount, currency=CURRENCY_CODE, order=self, @@ -1608,7 +1609,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): return self - def buy_without_registration(self, products: list, promocode_uuid: str, **kwargs) -> Transaction | None: + def buy_without_registration(self, products: list, promocode_uuid, **kwargs) -> Transaction | None: if config.DISABLED_COMMERCE: raise DisabledCommerceError(_("you can not buy at this moment, please try again in a few minutes")) @@ -1701,7 +1702,7 @@ class Order(ExportModelOperationsMixin("order"), NiceModel): return self -class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): +class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents a product associated with an order. @@ -1727,31 +1728,31 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): is_publicly_visible = False - buy_price: float = FloatField( # type: ignore + buy_price = FloatField( blank=True, null=True, help_text=_("the price paid by the customer for this product at purchase time"), verbose_name=_("purchase price at order time"), ) - comments: str = TextField( # type: ignore + comments = TextField( blank=True, null=True, help_text=_("internal comments for admins about this ordered product"), verbose_name=_("internal comments"), ) - notifications: dict = JSONField( # type: ignore + notifications = JSONField( blank=True, null=True, help_text=_("json structure of notifications to display to users"), verbose_name=_("user notifications"), ) - attributes: dict = JSONField( # type: ignore + attributes = JSONField( blank=True, null=True, help_text=_("json representation of this item's attributes"), verbose_name=_("ordered product attributes"), ) - order: Order = ForeignKey( # type: ignore + order = ForeignKey( "core.Order", on_delete=CASCADE, help_text=_("reference to the parent order that contains this product"), @@ -1759,7 +1760,7 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): related_name="order_products", null=True, ) - product: Product = ForeignKey( # type: ignore + product = ForeignKey( "core.Product", on_delete=PROTECT, blank=True, @@ -1767,14 +1768,14 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): help_text=_("the specific product associated with this order line"), verbose_name=_("associated product"), ) - quantity: int = PositiveIntegerField( # type: ignore + quantity = PositiveIntegerField( blank=False, null=False, default=1, help_text=_("quantity of this specific product in the order"), verbose_name=_("product quantity"), ) - status: str = CharField( # type: ignore + status = CharField( max_length=128, blank=False, null=False, @@ -1785,7 +1786,7 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): ) def __str__(self) -> str: - return f"{self.product.name} for ({self.order.user.email if self.order.user else 'unregistered user'})" # type: ignore + return f"{self.product.name} for ({self.order.user.email if self.order.user else 'unregistered user'})" class Meta: verbose_name = _("order product") @@ -1825,30 +1826,31 @@ class OrderProduct(ExportModelOperationsMixin("order_product"), NiceModel): return self @property - def total_price(self) -> float: - return round(self.buy_price * self.quantity, 2) + def total_price(self: Self) -> float: + return round(float(self.buy_price) * self.quantity, 2) @property - def download_url(self) -> str: - if self.product.is_digital and self.product.stocks.first().digital_asset: # type: ignore - return self.download.url + def download_url(self: Self) -> str: + if self.product: + if self.product.is_digital and self.product.stocks.first().digital_asset: + return self.download.url return "" - def do_feedback(self, rating: int = 10, comment: str = "", action: str = "add") -> Optional["Feedback"]: + def do_feedback(self, rating=10, comment="", action="add") -> Optional["Feedback"]: if action not in ["add", "remove"]: raise ValueError(_(f"wrong action specified for feedback: {action}")) if action == "remove" and self.feedback: self.feedback.delete() return None if action == "add" and not self.feedback: - if self.order.status not in ["MOMENTAL", "PENDING"]: # type: ignore + if self.order.status not in ["MOMENTAL", "PENDING"]: return Feedback.objects.create(rating=rating, comment=comment, order_product=self) else: raise ValueError(_("you cannot feedback an order which is not received")) return None -class DigitalAssetDownload(ExportModelOperationsMixin("attribute_group"), NiceModel): +class DigitalAssetDownload(ExportModelOperationsMixin("attribute_group"), NiceModel): # type: ignore [misc, django-manager-missing] """ Represents the downloading functionality for digital assets associated with orders. @@ -1875,8 +1877,8 @@ class DigitalAssetDownload(ExportModelOperationsMixin("attribute_group"), NiceMo is_publicly_visible = False - order_product: OneToOneField = OneToOneField(to=OrderProduct, on_delete=CASCADE, related_name="download") # type: ignore - num_downloads: int = IntegerField(default=0) # type: ignore + order_product = OneToOneField(to=OrderProduct, on_delete=CASCADE, related_name="download") + num_downloads = IntegerField(default=0) class Meta: verbose_name = _("download") @@ -1895,7 +1897,7 @@ class DigitalAssetDownload(ExportModelOperationsMixin("attribute_group"), NiceMo ) -class Feedback(ExportModelOperationsMixin("feedback"), NiceModel): +class Feedback(ExportModelOperationsMixin("feedback"), NiceModel): # type: ignore [misc, django-manager-missing] """ Manages user feedback for products. @@ -1915,13 +1917,13 @@ class Feedback(ExportModelOperationsMixin("feedback"), NiceModel): is_publicly_visible = True - comment: str = TextField( # type: ignore + comment = TextField( blank=True, null=True, help_text=_("user-provided comments about their experience with the product"), verbose_name=_("feedback comments"), ) - order_product: OrderProduct = OneToOneField( # type: ignore + order_product = OneToOneField( "core.OrderProduct", on_delete=CASCADE, blank=False, @@ -1929,7 +1931,7 @@ class Feedback(ExportModelOperationsMixin("feedback"), NiceModel): help_text=_("references the specific product in an order that this feedback is about"), verbose_name=_("related order product"), ) - rating: float = FloatField( # type: ignore + rating = FloatField( blank=True, null=True, help_text=_("user-assigned rating for the product"), diff --git a/core/serializers/detail.py b/core/serializers/detail.py index 87e20964..059d2623 100644 --- a/core/serializers/detail.py +++ b/core/serializers/detail.py @@ -1,5 +1,6 @@ import logging from contextlib import suppress +from typing import Collection, Any from django.contrib.auth.models import AnonymousUser from django.core.cache import cache @@ -113,7 +114,7 @@ class CategoryDetailSerializer(ModelSerializer): return filterable_results - def get_children(self, obj) -> list: + def get_children(self, obj) -> Collection[Any]: request = self.context.get("request") if request is not None and request.user.has_perm("view_category"): children = obj.children.all() diff --git a/core/serializers/simple.py b/core/serializers/simple.py index 6f9e01ce..bba6acf5 100644 --- a/core/serializers/simple.py +++ b/core/serializers/simple.py @@ -26,8 +26,8 @@ from core.serializers.utility import AddressSerializer class AttributeGroupSimpleSerializer(ModelSerializer): - parent: PrimaryKeyRelatedField = PrimaryKeyRelatedField(read_only=True) # type: ignore - children: PrimaryKeyRelatedField = PrimaryKeyRelatedField(many=True, read_only=True) # type: ignore + parent = PrimaryKeyRelatedField(read_only=True) + children = PrimaryKeyRelatedField(many=True, read_only=True) class Meta: model = AttributeGroup diff --git a/core/serializers/utility.py b/core/serializers/utility.py index 0fc2437e..37d14d95 100644 --- a/core/serializers/utility.py +++ b/core/serializers/utility.py @@ -89,7 +89,7 @@ class DoFeedbackSerializer(Serializer): class CacheOperatorSerializer(Serializer): key = CharField(required=True) - data = JSONField(required=False) # type: ignore + data = JSONField(required=False) timeout = IntegerField(required=False) diff --git a/core/templates/digital_order_delivered_email.html b/core/templates/digital_order_delivered_email.html index 7b2df364..543a7623 100644 --- a/core/templates/digital_order_delivered_email.html +++ b/core/templates/digital_order_delivered_email.html @@ -1,5 +1,4 @@ {% load tz static i18n filters conditions %} - diff --git a/core/utils/db.py b/core/utils/db.py index 4bd24c3e..d327614c 100644 --- a/core/utils/db.py +++ b/core/utils/db.py @@ -1,24 +1,12 @@ import logging -from django.db.models import Model from django.db.models.constants import LOOKUP_SEP -from django.utils.translation import gettext_lazy as _ from django_extensions.db.fields import AutoSlugField from slugify import slugify logger = logging.getLogger("evibes") -def list_to_queryset(model: Model, data: list): - if not isinstance(model, Model): - raise ValueError(_(f"{model} must be model")) - if not isinstance(data, list): - raise ValueError(_(f"{data} must be list object")) - - pk_list = [obj.pk for obj in data] - return model.objects.filter(pk__in=pk_list) - - def unicode_slugify_function(content): return slugify( text=str(content), diff --git a/core/utils/emailing.py b/core/utils/emailing.py index db43d824..c70441b5 100644 --- a/core/utils/emailing.py +++ b/core/utils/emailing.py @@ -47,7 +47,10 @@ def send_order_created_email(order_pk: str) -> tuple[bool, str]: except Order.DoesNotExist: return False, f"Order not found with the given pk: {order_pk}" - activate(order.user.language) # type: ignore + if not order.user: + return False, f"Order's user not found with the given pk: {order_pk}" + + activate(order.user.language) set_email_settings() connection = mail.get_connection() @@ -64,7 +67,7 @@ def send_order_created_email(order_pk: str) -> tuple[bool, str]: "total_price": order.total_price, }, ), - to=[order.user.email], # type: ignore + to=[order.user.email], from_email=f"{config.PROJECT_NAME} <{config.EMAIL_FROM}>", connection=connection, ) @@ -80,7 +83,7 @@ def send_order_finished_email(order_pk: str) -> tuple[bool, str]: if len(ops) <= 0: return - activate(order.user.language) # type: ignore + activate(order.user.language) set_email_settings() connection = mail.get_connection() @@ -91,16 +94,16 @@ def send_order_finished_email(order_pk: str) -> tuple[bool, str]: template_name="digital_order_delivered_email.html", context={ "order_uuid": order.human_readable_id, - "user_first_name": order.user.first_name, # type: ignore + "user_first_name": order.user.first_name, "order_products": ops, "project_name": config.PROJECT_NAME, "contact_email": config.EMAIL_FROM, "total_price": round(sum(op.buy_price for op in ops), 2), - "display_system_attributes": order.user.has_perm("core.view_order"), # type: ignore + "display_system_attributes": order.user.has_perm("core.view_order"), "today": datetime.today(), }, ), - to=[order.user.email], # type: ignore + to=[order.user.email], from_email=f"{config.PROJECT_NAME} <{config.EMAIL_FROM}>", connection=connection, ) @@ -110,7 +113,7 @@ def send_order_finished_email(order_pk: str) -> tuple[bool, str]: def send_thank_you_email(ops: list[OrderProduct]): if ops: pass - activate(order.user.language) # type: ignore + activate(order.user.language) set_email_settings() @@ -121,6 +124,9 @@ def send_order_finished_email(order_pk: str) -> tuple[bool, str]: except Order.DoesNotExist: return False, f"Order not found with the given pk: {order_pk}" + if not order.user: + return False, f"Order's user not found with the given pk: {order_pk}" + digital_ops = [] for digital_op in order.order_products.filter( diff --git a/core/vendors/__init__.py b/core/vendors/__init__.py index 61933bd3..f71c2e4e 100644 --- a/core/vendors/__init__.py +++ b/core/vendors/__init__.py @@ -145,7 +145,7 @@ class AbstractVendor: return value, "string" @staticmethod - def auto_resolver_helper(model: Brand | Category, resolving_name: str) -> Brand | Category | None: + def auto_resolver_helper(model: type[Brand] | type[Category], resolving_name: str) -> Brand | Category | None: queryset = model.objects.filter(name=resolving_name) if not queryset.exists(): if len(resolving_name) > 255: @@ -178,7 +178,7 @@ class AbstractVendor: except Category.DoesNotExist: pass - return self.auto_resolver_helper(Category, category_name) # type: ignore + return self.auto_resolver_helper(Category, category_name) def auto_resolve_brand(self, brand_name: str): if brand_name: @@ -196,7 +196,7 @@ class AbstractVendor: except Brand.DoesNotExist: pass - return self.auto_resolver_helper(Brand, brand_name) # type: ignore + return self.auto_resolver_helper(Brand, brand_name) def resolve_price( self, @@ -213,7 +213,7 @@ class AbstractVendor: price = float(original_price) if category and category.markup_percent: - price *= 1 + float(category.markup_percent) / 100.0 # type: ignore + price *= 1 + float(category.markup_percent) / 100.0 elif vendor and vendor.markup_percent: price *= 1 + vendor.markup_percent / 100.0 @@ -268,8 +268,8 @@ class AbstractVendor: if vendor.is_active: return vendor raise VendorError(f"Vendor {self.vendor_name!r} is inactive...") - except Vendor.DoesNotExist: - raise Exception(f"No matching vendor found with name {self.vendor_name!r}...") + except Vendor.DoesNotExist as dne: + raise Exception(f"No matching vendor found with name {self.vendor_name!r}...") from dne def get_products(self): pass @@ -288,6 +288,7 @@ class AbstractVendor: def prepare_for_stock_update(self, method: str = "deactivate") -> None: products = self.get_products_queryset() + # noinspection PyUnreachableCode match method: case "deactivate": products.update(is_active=False) @@ -301,6 +302,7 @@ class AbstractVendor: def delete_inactives(self, inactivation_method: str = "deactivate"): products = self.get_products_queryset() + # noinspection PyUnreachableCode match inactivation_method: case "deactivate": products.filter(is_active=False).delete() @@ -339,7 +341,7 @@ class AbstractVendor: defaults={"is_active": True}, ) except Attribute.MultipleObjectsReturned: - attribute = Attribute.objects.filter(name=key, group=attr_group).order_by("uuid").first() # type: ignore + attribute = Attribute.objects.filter(name=key, group=attr_group).order_by("uuid").first() # type: ignore [assignment] attribute.is_active = True attribute.value_type = attr_value_type attribute.save() diff --git a/core/views.py b/core/views.py index 54f53ec6..706aa34e 100644 --- a/core/views.py +++ b/core/views.py @@ -102,9 +102,6 @@ class CustomGraphQLView(FileUploadGraphQLView): This class serves as a customization extension of FileUploadGraphQLView that allows modification or enhancement of specific behaviors, particularly the context handling for GraphQL requests. - Attributes - ---------- - None """ def get_context(self, request): @@ -520,8 +517,8 @@ def favicon_view(request, *args, **kwargs): try: favicon_path = os.path.join(settings.BASE_DIR, "static/favicon.png") return FileResponse(open(favicon_path, "rb"), content_type="image/x-icon") - except FileNotFoundError: - raise Http404(_("favicon not found")) + except FileNotFoundError as fnfe: + raise Http404(_("favicon not found")) from fnfe def index(request, *args, **kwargs): diff --git a/core/viewsets.py b/core/viewsets.py index f4ebd8bc..66345185 100644 --- a/core/viewsets.py +++ b/core/viewsets.py @@ -2,7 +2,7 @@ import logging import uuid from uuid import UUID -from django.db.models import Q, QuerySet +from django.db.models import Q from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils.decorators import method_decorator @@ -378,7 +378,7 @@ class ProductViewSet(EvibesViewSet): lookup_val = kwargs.get(self.lookup_field) try: product = Product.objects.get(uuid=lookup_val) - feedbacks: QuerySet[Feedback] = ( # type: ignore + feedbacks = ( Feedback.objects.filter(order_product__product=product) if request.user.has_perm("core.view_feedback") else Feedback.objects.filter(order_product__product=product, is_active=True) diff --git a/evibes/celery.py b/evibes/celery.py index 489ae785..3e82a644 100644 --- a/evibes/celery.py +++ b/evibes/celery.py @@ -29,7 +29,7 @@ app.conf.update( ) app.conf.task_routes = { - 'core.tasks.update_products_task': {'queue': 'stock_updater'}, + "core.tasks.update_products_task": {"queue": "stock_updater"}, } app.config_from_object("django.conf:settings", namespace="CELERY") diff --git a/evibes/pagination.py b/evibes/pagination.py index be486861..99a9bd17 100644 --- a/evibes/pagination.py +++ b/evibes/pagination.py @@ -10,9 +10,9 @@ class CustomPagination(PageNumberPagination): { "links": {"forward": self.get_next_link(), "backward": self.get_previous_link()}, "counts": { - "total_pages": None or self.page.paginator.num_pages, # type: ignore - "page_size": None or self.page_size, # type: ignore - "total_items": None or self.page.paginator.count, # type: ignore + "total_pages": None or self.page.paginator.num_pages, # type: ignore [union-attr] + "page_size": None or self.page_size, + "total_items": None or self.page.paginator.count, # type: ignore [union-attr] }, "data": data, } diff --git a/evibes/settings/base.py b/evibes/settings/base.py index ee4115fe..06818deb 100644 --- a/evibes/settings/base.py +++ b/evibes/settings/base.py @@ -1,5 +1,5 @@ import logging -from os import getenv +from os import getenv, name from pathlib import Path EVIBES_VERSION = "2.9.0" @@ -9,7 +9,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent.parent SECRET_KEY = getenv("SECRET_KEY", "SUPER_SECRET_KEY") DEBUG = bool(int(getenv("DEBUG", "1"))) -ALLOWED_HOSTS = { +ALLOWED_HOSTS: set = { "app", "worker", "beat", @@ -27,9 +27,9 @@ else: for entry in getenv("ALLOWED_HOSTS", "").split(" "): ALLOWED_HOSTS.add(entry) -ALLOWED_HOSTS = tuple(ALLOWED_HOSTS) # type: ignore +ALLOWED_HOSTS: tuple = tuple(ALLOWED_HOSTS) -CSRF_TRUSTED_ORIGINS = { +CSRF_TRUSTED_ORIGINS: set = { "http://127.0.0.1", "http://api.localhost", "http://b2b.localhost", @@ -38,12 +38,12 @@ CSRF_TRUSTED_ORIGINS = { for entry in getenv("CSRF_TRUSTED_ORIGINS", "").split(" "): CSRF_TRUSTED_ORIGINS.add(entry) -CSRF_TRUSTED_ORIGINS = tuple(CSRF_TRUSTED_ORIGINS) # type: ignore +CSRF_TRUSTED_ORIGINS: tuple = tuple(CSRF_TRUSTED_ORIGINS) if DEBUG: CORS_ALLOW_ALL_ORIGINS = True else: - CORS_ALLOWED_ORIGINS = { + CORS_ALLOWED_ORIGINS: set = { "http://127.0.0.1", "http://api.localhost", "http://b2b.localhost", @@ -51,7 +51,7 @@ else: for entry in getenv("CORS_ALLOWED_ORIGINS", "").split(" "): CORS_ALLOWED_ORIGINS.add(entry) - CORS_ALLOWED_ORIGINS = tuple(CORS_ALLOWED_ORIGINS) # type: ignore + CORS_ALLOWED_ORIGINS: tuple = tuple(CORS_ALLOWED_ORIGINS) CORS_ALLOW_METHODS = ( "DELETE", @@ -342,3 +342,7 @@ STORAGES: dict[str, dict[str, str | int | bool | None]] = { "BACKEND": "django.core.files.storage.FileSystemStorage", }, } + +if name == "nt": + GDAL_LIBRARY_PATH = r"C:\OSGeo4W\bin\gdal311.dll" + GEOS_LIBRARY_PATH = r"C:\OSGeo4W\bin\geos_c.dll" diff --git a/evibes/settings/database.py b/evibes/settings/database.py index 3036c70c..cdbe49f3 100644 --- a/evibes/settings/database.py +++ b/evibes/settings/database.py @@ -1,11 +1,11 @@ -from evibes.settings.base import * # noqa: F403 +from evibes.settings.base import getenv DATABASES = { "default": { "ENGINE": "django_prometheus.db.backends.postgis", - "NAME": getenv("POSTGRES_DB"), # noqa: F405 - "USER": getenv("POSTGRES_USER"), # noqa: F405 - "PASSWORD": getenv("POSTGRES_PASSWORD"), # noqa: F405 + "NAME": getenv("POSTGRES_DB"), + "USER": getenv("POSTGRES_USER"), + "PASSWORD": getenv("POSTGRES_PASSWORD"), "HOST": "database", "PORT": 5432, } diff --git a/evibes/settings/emailing.py b/evibes/settings/emailing.py index c2eccc79..8a90b999 100644 --- a/evibes/settings/emailing.py +++ b/evibes/settings/emailing.py @@ -1,9 +1,9 @@ from evibes.settings import CONSTANCE_CONFIG EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" -EMAIL_HOST = CONSTANCE_CONFIG.get("EMAIL_HOST")[0] # type: ignore -EMAIL_PORT = CONSTANCE_CONFIG.get("EMAIL_PORT")[0] # type: ignore -EMAIL_USE_TLS = CONSTANCE_CONFIG.get("EMAIL_USE_TLS")[0] # type: ignore -EMAIL_USE_SSL = CONSTANCE_CONFIG.get("EMAIL_USE_SSL")[0] # type: ignore -EMAIL_HOST_USER = CONSTANCE_CONFIG.get("EMAIL_HOST_USER")[0] # type: ignore -EMAIL_HOST_PASSWORD = CONSTANCE_CONFIG.get("EMAIL_HOST_PASSWORD")[0] # type: ignore +EMAIL_HOST = CONSTANCE_CONFIG.get("EMAIL_HOST")[0] +EMAIL_PORT = CONSTANCE_CONFIG.get("EMAIL_PORT")[0] +EMAIL_USE_TLS = CONSTANCE_CONFIG.get("EMAIL_USE_TLS")[0] +EMAIL_USE_SSL = CONSTANCE_CONFIG.get("EMAIL_USE_SSL")[0] +EMAIL_HOST_USER = CONSTANCE_CONFIG.get("EMAIL_HOST_USER")[0] +EMAIL_HOST_PASSWORD = CONSTANCE_CONFIG.get("EMAIL_HOST_PASSWORD")[0] diff --git a/evibes/settings/jazzmin.py b/evibes/settings/jazzmin.py index 543e8e5b..a15ceb1e 100644 --- a/evibes/settings/jazzmin.py +++ b/evibes/settings/jazzmin.py @@ -4,9 +4,9 @@ from evibes.settings.base import EVIBES_VERSION from evibes.settings.constance import CONSTANCE_CONFIG JAZZMIN_SETTINGS = { - "site_title": f"{CONSTANCE_CONFIG.get('PROJECT_NAME')[0]} Admin", # type: ignore - "site_header": str(CONSTANCE_CONFIG.get("PROJECT_NAME")[0]), # type: ignore - "site_brand": str(CONSTANCE_CONFIG.get("PROJECT_NAME")[0]), # type: ignore + "site_title": f"{CONSTANCE_CONFIG.get('PROJECT_NAME')[0]} Admin", # type: ignore [index] + "site_header": str(CONSTANCE_CONFIG.get("PROJECT_NAME")[0]), # type: ignore [index] + "site_brand": str(CONSTANCE_CONFIG.get("PROJECT_NAME")[0]), # type: ignore [index] "site_logo": "logo.png", "login_logo": "logo.png", "login_logo_dark": "logo.png", @@ -18,21 +18,21 @@ JAZZMIN_SETTINGS = { "user_avatar": "avatar", "topmenu_links": [ {"name": _("Home"), "url": "admin:index"}, - {"name": _("Storefront"), "url": f"https://{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}", "new_window": True}, + {"name": _("Storefront"), "url": f"https://{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}", "new_window": True}, # type: ignore [index] {"name": "GitLab", "url": "https://gitlab.com/wiseless/evibes", "new_window": True}, { "name": _("GraphQL Docs"), - "url": f"https://api.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/graphql", # type: ignore + "url": f"https://api.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/graphql", # type: ignore [index] "new_window": True, }, { "name": _("Platform REST Docs"), - "url": f"https://api.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/docs/swagger", # type: ignore + "url": f"https://api.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/docs/swagger", # type: ignore [index] "new_window": True, }, { "name": _("B2B REST Docs"), - "url": f"https://b2b.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/docs/swagger", # type: ignore + "url": f"https://b2b.{CONSTANCE_CONFIG.get('BASE_DOMAIN')[0]}/docs/swagger", # type: ignore [index] "new_window": True, }, {"name": _("Support"), "url": "https://t.me/fureunoir", "new_window": True}, diff --git a/evibes/settings/logconfig.py b/evibes/settings/logconfig.py index 2a219f8f..375d7f6c 100644 --- a/evibes/settings/logconfig.py +++ b/evibes/settings/logconfig.py @@ -6,8 +6,11 @@ class SkipVariableDoesNotExistFilter(logging.Filter): # noqa: F405 if record.exc_info: exc_type, exc_instance, _ = record.exc_info try: - if exc_type.__name__ == "VariableDoesNotExist": # type: ignore - return False + if exc_type is not None: + if exc_type.__name__ == "VariableDoesNotExist": + return False + else: + return True except AttributeError: return True return "VariableDoesNotExist" not in record.getMessage() diff --git a/payments/graphene/object_types.py b/payments/graphene/object_types.py index 69d59408..c39091a3 100644 --- a/payments/graphene/object_types.py +++ b/payments/graphene/object_types.py @@ -11,8 +11,9 @@ class TransactionType(DjangoObjectType): process = GenericScalar() def resolve_process(self: Transaction, info) -> dict: - if info.context.user == self.balance.user: - return self.process + if self.balance is not None: + if info.context.user == self.balance.user: + return self.process return {} class Meta: diff --git a/payments/migrations/0001_initial.py b/payments/migrations/0001_initial.py index 1dd62ba0..06280b64 100644 --- a/payments/migrations/0001_initial.py +++ b/payments/migrations/0001_initial.py @@ -9,55 +9,96 @@ from django.db import migrations, models class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Balance', + name="Balance", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('amount', models.FloatField(default=0)), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("amount", models.FloatField(default=0)), ], options={ - 'verbose_name': 'balance', - 'verbose_name_plural': 'balances', + "verbose_name": "balance", + "verbose_name_plural": "balances", }, ), migrations.CreateModel( - name='Transaction', + name="Transaction", fields=[ - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('is_active', models.BooleanField(default=True, - help_text="if set to false, this object can't be seen by users without needed permission", - verbose_name='is active')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('amount', models.FloatField()), - ('currency', models.CharField(max_length=3)), - ('payment_method', models.CharField(max_length=20)), - ('process', models.JSONField(default=dict, verbose_name='processing details')), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="if set to false, this object can't be seen by users without needed permission", + verbose_name="is active", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ("amount", models.FloatField()), + ("currency", models.CharField(max_length=3)), + ("payment_method", models.CharField(max_length=20)), + ("process", models.JSONField(default=dict, verbose_name="processing details")), ], options={ - 'verbose_name': 'transaction', - 'verbose_name_plural': 'transactions', + "verbose_name": "transaction", + "verbose_name_plural": "transactions", }, ), ] diff --git a/payments/migrations/0002_initial.py b/payments/migrations/0002_initial.py index d9618a27..480ec9b6 100644 --- a/payments/migrations/0002_initial.py +++ b/payments/migrations/0002_initial.py @@ -10,32 +10,42 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('core', '0002_initial'), - ('payments', '0001_initial'), + ("core", "0002_initial"), + ("payments", "0001_initial"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.AddField( - model_name='balance', - name='user', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='payments_balance', - to=settings.AUTH_USER_MODEL, blank=True, null=True), + model_name="balance", + name="user", + field=models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name="payments_balance", + to=settings.AUTH_USER_MODEL, + blank=True, + null=True, + ), ), migrations.AddField( - model_name='transaction', - name='balance', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payments.balance'), + model_name="transaction", + name="balance", + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="payments.balance"), ), migrations.AddField( - model_name='transaction', - name='order', - field=models.ForeignKey(blank=True, help_text='order to process after paid', null=True, - on_delete=django.db.models.deletion.CASCADE, related_name='payments_transactions', - to='core.order'), + model_name="transaction", + name="order", + field=models.ForeignKey( + blank=True, + help_text="order to process after paid", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="payments_transactions", + to="core.order", + ), ), migrations.AddIndex( - model_name='transaction', - index=django.contrib.postgres.indexes.GinIndex(fields=['process'], name='payments_tr_process_d5b008_gin'), + model_name="transaction", + index=django.contrib.postgres.indexes.GinIndex(fields=["process"], name="payments_tr_process_d5b008_gin"), ), ] diff --git a/payments/migrations/0003_alter_transaction_balance.py b/payments/migrations/0003_alter_transaction_balance.py index ea6bdece..029e2448 100644 --- a/payments/migrations/0003_alter_transaction_balance.py +++ b/payments/migrations/0003_alter_transaction_balance.py @@ -5,15 +5,20 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('payments', '0002_initial'), + ("payments", "0002_initial"), ] operations = [ migrations.AlterField( - model_name='transaction', - name='balance', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='payments.balance'), + model_name="transaction", + name="balance", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="transactions", + to="payments.balance", + ), ), ] diff --git a/payments/migrations/0004_alter_transaction_payment_method.py b/payments/migrations/0004_alter_transaction_payment_method.py index 241ecc4a..978c5214 100644 --- a/payments/migrations/0004_alter_transaction_payment_method.py +++ b/payments/migrations/0004_alter_transaction_payment_method.py @@ -4,15 +4,14 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('payments', '0003_alter_transaction_balance'), + ("payments", "0003_alter_transaction_balance"), ] operations = [ migrations.AlterField( - model_name='transaction', - name='payment_method', + model_name="transaction", + name="payment_method", field=models.CharField(blank=True, max_length=20, null=True), ), ] diff --git a/payments/models.py b/payments/models.py index 14eeeaaf..6678715b 100644 --- a/payments/models.py +++ b/payments/models.py @@ -7,13 +7,11 @@ from core.abstract import NiceModel class Transaction(NiceModel): - amount: float = FloatField(null=False, blank=False) # type: ignore - balance: "Balance" = ForeignKey( - "payments.Balance", on_delete=CASCADE, blank=True, null=True, related_name="transactions" - ) # type: ignore - currency: str = CharField(max_length=3, null=False, blank=False) # type: ignore - payment_method: str = CharField(max_length=20, null=True, blank=True) # type: ignore - order = ForeignKey( # type: ignore + amount = FloatField(null=False, blank=False) + balance = ForeignKey("payments.Balance", on_delete=CASCADE, blank=True, null=True, related_name="transactions") + currency = CharField(max_length=3, null=False, blank=False) + payment_method = CharField(max_length=20, null=True, blank=True) + order = ForeignKey( "core.Order", on_delete=CASCADE, blank=True, @@ -21,7 +19,7 @@ class Transaction(NiceModel): help_text=_("order to process after paid"), related_name="payments_transactions", ) - process: dict = JSONField(verbose_name=_("processing details"), default=dict) # type: ignore + process = JSONField(verbose_name=_("processing details"), default=dict) def __str__(self): return f"{self.balance.user.email} | {self.amount}" @@ -48,8 +46,8 @@ class Transaction(NiceModel): class Balance(NiceModel): - amount: float = FloatField(null=False, blank=False, default=0) # type: ignore - user = OneToOneField( # type: ignore + amount = FloatField(null=False, blank=False, default=0) + user = OneToOneField( to="vibes_auth.User", on_delete=CASCADE, blank=True, null=True, related_name="payments_balance" ) transactions: QuerySet["Transaction"] diff --git a/payments/serializers.py b/payments/serializers.py index c3191e8f..faa92d4c 100644 --- a/payments/serializers.py +++ b/payments/serializers.py @@ -20,10 +20,10 @@ class TransactionProcessSerializer(ModelSerializer): order_uuid = SerializerMethodField(read_only=True, required=False) def get_order_hr_id(self, obj: Transaction) -> str | None: - return obj.order.human_readable_id if obj.order else None # type: ignore + return obj.order.human_readable_id if obj.order else None def get_order_uuid(self, obj: Transaction) -> str | None: - return str(obj.order.uuid) if obj.order else None # type: ignore + return str(obj.order.uuid) if obj.order else None class Meta: model = Transaction diff --git a/payments/signals.py b/payments/signals.py index b5e3d385..102654af 100644 --- a/payments/signals.py +++ b/payments/signals.py @@ -25,7 +25,7 @@ def process_transaction_changes(instance, created, **_kwargs): case _: gateway = AbstractGateway() gateway.process_transaction(instance) - except Exception as e: # noqa: + except Exception as e: instance.process = {"status": "NOGATEWAY", "error": str(e)} if not created: status = instance.process.get("status", "").lower() diff --git a/payments/templates/balance_deposit_email.html b/payments/templates/balance_deposit_email.html index 509d0c06..0e2c5f31 100644 --- a/payments/templates/balance_deposit_email.html +++ b/payments/templates/balance_deposit_email.html @@ -1,5 +1,4 @@ {% load tz static i18n filters conditions %} - @@ -61,12 +60,6 @@ color: #888; } - .order-table { - width: 100%; - margin-top: 20px; - border-collapse: collapse; - } - .order-table th, .order-table td { border: 1px solid #ddd; padding: 8px; diff --git a/payments/utils/emailing.py b/payments/utils/emailing.py index 068ddd7d..34df0767 100644 --- a/payments/utils/emailing.py +++ b/payments/utils/emailing.py @@ -19,7 +19,10 @@ def balance_deposit_email(transaction_pk: str) -> tuple[bool, str]: except Transaction.DoesNotExist: return False, f"Transaction not found with the given pk: {transaction_pk}" - activate(transaction.balance.user.language) # type: ignore + if not transaction.balance or not transaction.balance.user: + return False, f"Balance not found for the given transaction pk: {transaction_pk}" + + activate(transaction.balance.user.language) set_email_settings() connection = mail.get_connection() @@ -31,13 +34,13 @@ def balance_deposit_email(transaction_pk: str) -> tuple[bool, str]: context={ "amount": transaction.amount, "balance": transaction.balance.amount, - "user_first_name": transaction.balance.user.first_name, # type: ignore + "user_first_name": transaction.balance.user.first_name, "project_name": config.PROJECT_NAME, "contact_email": config.EMAIL_FROM, "today": datetime.today(), }, ), - to=[transaction.balance.user.email], # type: ignore + to=[transaction.balance.user.email], from_email=f"{config.PROJECT_NAME} <{config.EMAIL_FROM}>", connection=connection, ) diff --git a/pyproject.toml b/pyproject.toml index ce5ae5da..d641ff21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,18 +103,21 @@ testing = ["pytest", "pytest-django", "coverage"] linting = ["black", "isort", "flake8", "bandit"] [tool.mypy] -disable_error_code = ["import-untyped", "misc"] -exclude = ["*/migrations/*", "./evibes/settings/drf.py"] +disable_error_code = ["no-redef", "import-untyped"] +exclude = ["*/migrations/*"] +plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"] + +[tool.django-stubs] +django_settings_module = "evibes.settings" [tool.ruff] line-length = 120 target-version = "py312" -exclude = ["migrations", "media", "static", "storefront"] +exclude = ["media", "static", "storefront"] [tool.ruff.lint] -select = ["E", "W", "F", "B", "I", "RUF", "UP", "N", "A", "COM", "C4", "DJ001", "RSE", "SIM", "ISC", "TID252", "PGH004"] -ignore = ["B904", "RUF001", "RUF002", "RUF003", "RUF005", "RUF012", "A003", "A002", "COM812", "S603"] -per-file-ignores = { "__init__.py" = ["E402", "F401"] } +select = ["E4", "E7", "E9", "F", "B", "Q"] +ignore = ["RUF012", "A002", "A003"] [tool.ruff.format] quote-style = "double" diff --git a/vibes_auth/graphene/mutations.py b/vibes_auth/graphene/mutations.py index 4660daaa..27864b51 100644 --- a/vibes_auth/graphene/mutations.py +++ b/vibes_auth/graphene/mutations.py @@ -102,9 +102,9 @@ class UpdateUser(BaseMutation): try: user = User.objects.get(uuid=uuid) - except User.DoesNotExist: + except User.DoesNotExist as dne: name = "User" - raise Http404(_(f"{name} does not exist: {uuid}")) + raise Http404(_(f"{name} does not exist: {uuid}")) from dne if not (info.context.user.has_perm("vibes_auth.change_user") or info.context.user == user): raise PermissionDenied(permission_denied_message) @@ -176,8 +176,8 @@ class DeleteUser(BaseMutation): else: raise BadRequest("uuid or email must be specified") return DeleteUser(success=True) - except User.DoesNotExist: - raise Http404(f"User with the given uuid: {uuid} or email: {email} does not exist.") + except User.DoesNotExist as dne: + raise Http404(f"User with the given uuid: {uuid} or email: {email} does not exist.") from dne raise PermissionDenied(permission_denied_message) @@ -201,7 +201,7 @@ class ObtainJSONWebToken(BaseMutation): access_token=serializer.validated_data["access"], ) except Exception as e: - raise PermissionDenied(f"invalid credentials provided: {e!s}") + raise PermissionDenied(f"invalid credentials provided: {e!s}") from e class RefreshJSONWebToken(BaseMutation): @@ -222,7 +222,7 @@ class RefreshJSONWebToken(BaseMutation): user=User.objects.get(uuid=serializer.validated_data["user"]["uuid"]), ) except Exception as e: - raise PermissionDenied(f"invalid refresh token provided: {e!s}") + raise PermissionDenied(f"invalid refresh token provided: {e!s}") from e class VerifyJSONWebToken(BaseMutation): @@ -270,7 +270,7 @@ class ActivateUser(BaseMutation): user.save() except (TypeError, ValueError, OverflowError, User.DoesNotExist) as e: - raise BadRequest(_(f"something went wrong: {e!s}")) + raise BadRequest(_(f"something went wrong: {e!s}")) from e return ActivateUser(success=True) @@ -322,7 +322,7 @@ class ConfirmResetPassword(BaseMutation): return ConfirmResetPassword(success=True) except (TypeError, ValueError, OverflowError, ValidationError, User.DoesNotExist) as e: - raise BadRequest(_(f"something went wrong: {e!s}")) + raise BadRequest(_(f"something went wrong: {e!s}")) from e class UploadAvatar(BaseMutation): @@ -339,6 +339,6 @@ class UploadAvatar(BaseMutation): info.context.user.avatar = avatar info.context.user.save() except Exception as e: - raise BadRequest(str(e)) + raise BadRequest(str(e)) from e return UploadAvatar(user=info.context.user) diff --git a/vibes_auth/migrations/0001_initial.py b/vibes_auth/migrations/0001_initial.py index e867215a..d0314d29 100644 --- a/vibes_auth/migrations/0001_initial.py +++ b/vibes_auth/migrations/0001_initial.py @@ -16,87 +16,179 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), + ("auth", "0012_alter_user_first_name_max_length"), ] operations = [ migrations.CreateModel( - name='Group', - fields=[ - ], + name="Group", + fields=[], options={ - 'verbose_name': 'group', - 'verbose_name_plural': 'groups', - 'proxy': True, - 'indexes': [], - 'constraints': [], + "verbose_name": "group", + "verbose_name_plural": "groups", + "proxy": True, + "indexes": [], + "constraints": [], }, - bases=('auth.group',), + bases=("auth.group",), managers=[ - ('objects', django.contrib.auth.models.GroupManager()), + ("objects", django.contrib.auth.models.GroupManager()), ], ), migrations.CreateModel( - name='User', + name="User", fields=[ - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, - help_text='Designates that this user has all permissions without explicitly assigning them.', - verbose_name='superuser status')), - ('is_staff', models.BooleanField(default=False, - help_text='Designates whether the user can log into this admin site.', - verbose_name='staff status')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, - help_text='unique id is used to surely identify any database object', - primary_key=True, serialize=False, verbose_name='unique id')), - ('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, - help_text='when the object first appeared on the database', - verbose_name='created')), - ('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, - help_text='when the object was last modified', - verbose_name='modified')), - ('email', - models.EmailField(help_text='user email address', max_length=254, unique=True, verbose_name='email')), - ('phone_number', - models.CharField(blank=True, help_text='user phone number', max_length=20, null=True, unique=True, - validators=[vibes_auth.validators.validate_phone_number], - verbose_name='phone_number')), - ('first_name', models.CharField(blank=True, max_length=150, null=True, verbose_name='first_name')), - ('last_name', models.CharField(blank=True, max_length=150, null=True, verbose_name='last_name')), - ('avatar', models.ImageField(blank=True, help_text='user profile image', null=True, - upload_to=vibes_auth.models.User.get_uuid_as_path, verbose_name='avatar')), - ('is_verified', - models.BooleanField(default=False, help_text='user verification status', verbose_name='is verified')), - ('is_active', models.BooleanField(default=False, help_text='unselect this instead of deleting accounts', - verbose_name='is_active')), - ('is_subscribed', models.BooleanField(default=False, help_text="user's newsletter subscription status", - verbose_name='is_subscribed')), - ('activation_token', models.UUIDField(default=uuid.uuid4, verbose_name='activation token')), - ('language', models.CharField( - choices=[('en-GB', 'English (British)'), ('ar-AR', 'العربية'), ('cs-CZ', 'Česky'), - ('da-DK', 'Dansk'), ('de-DE', 'Deutsch'), ('en-US', 'English (American)'), - ('es-ES', 'Español'), ('fr-FR', 'Français'), ('hi-IN', 'हिंदी'), ('it-IT', 'Italiano'), - ('ja-JP', '日本語'), ('kk-KZ', 'Қазақ'), ('nl-NL', 'Nederlands'), ('pl-PL', 'Polska'), - ('pt-BR', 'Português'), ('ro-RO', 'Română'), ('ru-RU', 'Русский'), - ('zh-hans', '简体中文')], default='en-GB', max_length=7)), - ('attributes', models.JSONField(blank=True, default=dict, null=True, verbose_name='attributes')), - ('groups', models.ManyToManyField(blank=True, - help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', - related_name='user_set', related_query_name='user', to='auth.group', - verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', - related_name='user_set', related_query_name='user', - to='auth.permission', verbose_name='user permissions')), + ("password", models.CharField(max_length=128, verbose_name="password")), + ("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")), + ( + "is_superuser", + models.BooleanField( + default=False, + help_text="Designates that this user has all permissions without explicitly assigning them.", + verbose_name="superuser status", + ), + ), + ( + "is_staff", + models.BooleanField( + default=False, + help_text="Designates whether the user can log into this admin site.", + verbose_name="staff status", + ), + ), + ("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")), + ( + "uuid", + models.UUIDField( + default=uuid.uuid4, + editable=False, + help_text="unique id is used to surely identify any database object", + primary_key=True, + serialize=False, + verbose_name="unique id", + ), + ), + ( + "created", + django_extensions.db.fields.CreationDateTimeField( + auto_now_add=True, + help_text="when the object first appeared on the database", + verbose_name="created", + ), + ), + ( + "modified", + django_extensions.db.fields.ModificationDateTimeField( + auto_now=True, help_text="when the object was last modified", verbose_name="modified" + ), + ), + ( + "email", + models.EmailField( + help_text="user email address", max_length=254, unique=True, verbose_name="email" + ), + ), + ( + "phone_number", + models.CharField( + blank=True, + help_text="user phone number", + max_length=20, + null=True, + unique=True, + validators=[vibes_auth.validators.validate_phone_number], + verbose_name="phone_number", + ), + ), + ("first_name", models.CharField(blank=True, max_length=150, null=True, verbose_name="first_name")), + ("last_name", models.CharField(blank=True, max_length=150, null=True, verbose_name="last_name")), + ( + "avatar", + models.ImageField( + blank=True, + help_text="user profile image", + null=True, + upload_to=vibes_auth.models.User.get_uuid_as_path, + verbose_name="avatar", + ), + ), + ( + "is_verified", + models.BooleanField( + default=False, help_text="user verification status", verbose_name="is verified" + ), + ), + ( + "is_active", + models.BooleanField( + default=False, help_text="unselect this instead of deleting accounts", verbose_name="is_active" + ), + ), + ( + "is_subscribed", + models.BooleanField( + default=False, help_text="user's newsletter subscription status", verbose_name="is_subscribed" + ), + ), + ("activation_token", models.UUIDField(default=uuid.uuid4, verbose_name="activation token")), + ( + "language", + models.CharField( + choices=[ + ("en-GB", "English (British)"), + ("ar-AR", "العربية"), + ("cs-CZ", "Česky"), + ("da-DK", "Dansk"), + ("de-DE", "Deutsch"), + ("en-US", "English (American)"), + ("es-ES", "Español"), + ("fr-FR", "Français"), + ("hi-IN", "हिंदी"), + ("it-IT", "Italiano"), + ("ja-JP", "日本語"), + ("kk-KZ", "Қазақ"), + ("nl-NL", "Nederlands"), + ("pl-PL", "Polska"), + ("pt-BR", "Português"), + ("ro-RO", "Română"), + ("ru-RU", "Русский"), + ("zh-hans", "简体中文"), + ], + default="en-GB", + max_length=7, + ), + ), + ("attributes", models.JSONField(blank=True, default=dict, null=True, verbose_name="attributes")), + ( + "groups", + models.ManyToManyField( + blank=True, + help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + related_name="user_set", + related_query_name="user", + to="auth.group", + verbose_name="groups", + ), + ), + ( + "user_permissions", + models.ManyToManyField( + blank=True, + help_text="Specific permissions for this user.", + related_name="user_set", + related_query_name="user", + to="auth.permission", + verbose_name="user permissions", + ), + ), ], options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'swappable': 'AUTH_USER_MODEL', + "verbose_name": "user", + "verbose_name_plural": "users", + "swappable": "AUTH_USER_MODEL", }, managers=[ - ('objects', vibes_auth.managers.UserManager()), + ("objects", vibes_auth.managers.UserManager()), ], ), ] diff --git a/vibes_auth/migrations/0002_blacklistedtoken_outstandingtoken.py b/vibes_auth/migrations/0002_blacklistedtoken_outstandingtoken.py index 01cc3c8f..e7b4a20a 100644 --- a/vibes_auth/migrations/0002_blacklistedtoken_outstandingtoken.py +++ b/vibes_auth/migrations/0002_blacklistedtoken_outstandingtoken.py @@ -4,37 +4,34 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('token_blacklist', '0012_alter_outstandingtoken_user'), - ('vibes_auth', '0001_initial'), + ("token_blacklist", "0012_alter_outstandingtoken_user"), + ("vibes_auth", "0001_initial"), ] operations = [ migrations.CreateModel( - name='BlacklistedToken', - fields=[ - ], + name="BlacklistedToken", + fields=[], options={ - 'verbose_name': 'blacklisted token', - 'verbose_name_plural': 'blacklisted tokens', - 'proxy': True, - 'indexes': [], - 'constraints': [], + "verbose_name": "blacklisted token", + "verbose_name_plural": "blacklisted tokens", + "proxy": True, + "indexes": [], + "constraints": [], }, - bases=('token_blacklist.blacklistedtoken',), + bases=("token_blacklist.blacklistedtoken",), ), migrations.CreateModel( - name='OutstandingToken', - fields=[ - ], + name="OutstandingToken", + fields=[], options={ - 'verbose_name': 'outstanding token', - 'verbose_name_plural': 'outstanding tokens', - 'proxy': True, - 'indexes': [], - 'constraints': [], + "verbose_name": "outstanding token", + "verbose_name_plural": "outstanding tokens", + "proxy": True, + "indexes": [], + "constraints": [], }, - bases=('token_blacklist.outstandingtoken',), + bases=("token_blacklist.outstandingtoken",), ), ] diff --git a/vibes_auth/migrations/0003_alter_user_language.py b/vibes_auth/migrations/0003_alter_user_language.py index 275a6145..92f7e0ca 100644 --- a/vibes_auth/migrations/0003_alter_user_language.py +++ b/vibes_auth/migrations/0003_alter_user_language.py @@ -5,54 +5,53 @@ from django.db.models.functions import Lower def forwards(apps, schema_editor): if schema_editor: pass - User = apps.get_model('vibes_auth', 'User') - User.objects.all().update(language=Lower('language')) + User = apps.get_model("vibes_auth", "User") + User.objects.all().update(language=Lower("language")) def backwards(apps, schema_editor): if schema_editor: pass - User = apps.get_model('vibes_auth', 'User') + User = apps.get_model("vibes_auth", "User") for u in User.objects.all(): - parts = u.language.split('-', 1) + parts = u.language.split("-", 1) if len(parts) == 2: u.language = f"{parts[0].lower()}-{parts[1].upper()}" - u.save(update_fields=['language']) + u.save(update_fields=["language"]) class Migration(migrations.Migration): dependencies = [ - ('vibes_auth', '0002_blacklistedtoken_outstandingtoken'), + ("vibes_auth", "0002_blacklistedtoken_outstandingtoken"), ] operations = [ migrations.RunPython(forwards, backwards), - migrations.AlterField( - model_name='user', - name='language', + model_name="user", + name="language", field=models.CharField( choices=[ - ('en-gb', 'English (British)'), - ('ar-ar', 'العربية'), - ('cs-cz', 'Česky'), - ('da-dk', 'Dansk'), - ('de-de', 'Deutsch'), - ('en-us', 'English (American)'), - ('es-es', 'Español'), - ('fr-fr', 'Français'), - ('hi-in', 'हिंदी'), - ('it-it', 'Italiano'), - ('ja-jp', '日本語'), - ('kk-kz', 'Қазақ'), - ('nl-nl', 'Nederlands'), - ('pl-pl', 'Polska'), - ('pt-br', 'Português'), - ('ro-ro', 'Română'), - ('ru-ru', 'Русский'), - ('zh-hans', '简体中文'), + ("en-gb", "English (British)"), + ("ar-ar", "العربية"), + ("cs-cz", "Česky"), + ("da-dk", "Dansk"), + ("de-de", "Deutsch"), + ("en-us", "English (American)"), + ("es-es", "Español"), + ("fr-fr", "Français"), + ("hi-in", "हिंदी"), + ("it-it", "Italiano"), + ("ja-jp", "日本語"), + ("kk-kz", "Қазақ"), + ("nl-nl", "Nederlands"), + ("pl-pl", "Polska"), + ("pt-br", "Português"), + ("ro-ro", "Română"), + ("ru-ru", "Русский"), + ("zh-hans", "简体中文"), ], - default='en-gb', + default="en-gb", max_length=7, ), ), diff --git a/vibes_auth/models.py b/vibes_auth/models.py index 384a0947..dfad3b7c 100644 --- a/vibes_auth/models.py +++ b/vibes_auth/models.py @@ -1,4 +1,3 @@ -import uuid from uuid import uuid4 from django.contrib.auth.models import AbstractUser @@ -21,6 +20,7 @@ from rest_framework_simplejwt.token_blacklist.models import ( OutstandingToken as BaseOutstandingToken, ) +from blog.models import Post from core.abstract import NiceModel from core.models import Order, Wishlist from evibes.settings import LANGUAGE_CODE, LANGUAGES @@ -83,8 +83,8 @@ class User(AbstractUser, NiceModel): def get_uuid_as_path(self, *args): return str(self.uuid) + "/" + args[0] - email: str = EmailField(_("email"), unique=True, help_text=_("user email address")) # type: ignore - phone_number: str = CharField( # type: ignore + email = EmailField(_("email"), unique=True, help_text=_("user email address")) + phone_number = CharField( _("phone_number"), max_length=20, unique=True, @@ -95,9 +95,10 @@ class User(AbstractUser, NiceModel): validate_phone_number, ], ) - username = None - first_name: str = CharField(_("first_name"), max_length=150, blank=True, null=True) # type: ignore - last_name: str = CharField(_("last_name"), max_length=150, blank=True, null=True) # type: ignore + username: None = None # type: ignore [assignment] + posts: "Post" + first_name = CharField(_("first_name"), max_length=150, blank=True, null=True) # type: ignore [assignment] + last_name = CharField(_("last_name"), max_length=150, blank=True, null=True) # type: ignore [assignment] avatar = ImageField( null=True, verbose_name=_("avatar"), @@ -106,28 +107,28 @@ class User(AbstractUser, NiceModel): help_text=_("user profile image"), ) - is_verified: bool = BooleanField( # type: ignore + is_verified = BooleanField( default=False, verbose_name=_("is verified"), help_text=_("user verification status"), ) - is_active: bool = BooleanField( # type: ignore + is_active = BooleanField( _("is_active"), default=False, help_text=_("unselect this instead of deleting accounts"), ) - is_subscribed: bool = BooleanField( # type: ignore + is_subscribed = BooleanField( verbose_name=_("is_subscribed"), help_text=_("user's newsletter subscription status"), default=False ) - activation_token: uuid = UUIDField(default=uuid4, verbose_name=_("activation token")) # type: ignore - language: str = CharField(choices=LANGUAGES, default=LANGUAGE_CODE, null=False, blank=False, max_length=7) # type: ignore - attributes: dict = JSONField(verbose_name=_("attributes"), default=dict, blank=True, null=True) # type: ignore + activation_token = UUIDField(default=uuid4, verbose_name=_("activation token")) + language = CharField(choices=LANGUAGES, default=LANGUAGE_CODE, null=False, blank=False, max_length=7) + attributes = JSONField(verbose_name=_("attributes"), default=dict, blank=True, null=True) USERNAME_FIELD = "email" REQUIRED_FIELDS = [] # noinspection PyClassVar - objects = UserManager() # type: ignore + objects = UserManager() # type: ignore [misc, assignment] payments_balance: "Balance" user_related_wishlist: "Wishlist" @@ -190,11 +191,6 @@ class OutstandingToken(BaseOutstandingToken): It does not add additional fields or logic to the base model but allows for overloading or extending its default functionality as required. - Attributes: - Meta (class): Contains metadata for the model, including options such as - whether the model is a proxy, the human-readable name for the model, and - the plural form of that name. - """ class Meta: @@ -214,8 +210,6 @@ class BlacklistedToken(BaseBlacklistedToken): meta options for the model, affecting its database and administrative representation. - Attributes: - None """ class Meta: diff --git a/vibes_auth/serializers.py b/vibes_auth/serializers.py index ad0094b6..a182cb03 100644 --- a/vibes_auth/serializers.py +++ b/vibes_auth/serializers.py @@ -112,7 +112,7 @@ class TokenObtainSerializer(Serializer): def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) - self.user = None + self.user: User | None = None self.fields[self.username_field] = CharField(write_only=True) self.fields["password"] = PasswordField() @@ -124,19 +124,22 @@ class TokenObtainSerializer(Serializer): with suppress(KeyError): authenticate_kwargs["request"] = self.context["request"] - self.user = authenticate(**authenticate_kwargs) # type: ignore + self.user: User | None = authenticate(**authenticate_kwargs) if not api_settings.USER_AUTHENTICATION_RULE(self.user): raise AuthenticationFailed( self.error_messages["no_active_account"], - _("no active account"), # type: ignore + str(_("no active account")), ) return {} @classmethod def get_token(cls, user: AuthUser) -> Token: - return cls.token_class.for_user(user) # type: ignore + if cls.token_class is not None: + return cls.token_class.for_user(user) + else: + raise RuntimeError(_("must set token_class attribute on class.")) class TokenObtainPairSerializer(TokenObtainSerializer): @@ -147,15 +150,19 @@ class TokenObtainPairSerializer(TokenObtainSerializer): logger.debug("Data validated") - refresh = self.get_token(self.user) # type: ignore + if self.user is None: + raise ValidationError(_("no active account")) + + refresh = self.get_token(self.user) data["refresh"] = str(refresh) - data["access"] = str(refresh.access_token) # type: ignore + # noinspection PyUnresolvedReferences + data["access"] = str(refresh.access_token) # type: ignore [attr-defined] data["user"] = UserSerializer(self.user).data logger.debug("Data formed") if api_settings.UPDATE_LAST_LOGIN: - update_last_login(self.user, self.user) # type: ignore + update_last_login(self.user, self.user) logger.debug("Updated last login") logger.debug("Returning data") @@ -183,7 +190,8 @@ class TokenRefreshSerializer(Serializer): data["refresh"] = str(refresh) user = User.objects.get(uuid=refresh.payload["user_uuid"]) - data["user"] = UserSerializer(user).data # type: ignore + # noinspection PyTypeChecker + data["user"] = UserSerializer(user).data return data @@ -204,18 +212,19 @@ class TokenVerifySerializer(Serializer): try: payload = UntypedToken(attrs["token"]).payload - except TokenError: - raise ValidationError(_("invalid token")) + except TokenError as te: + raise ValidationError(_("invalid token")) from te try: user_uuid = payload["user_uuid"] user = User.objects.get(uuid=user_uuid) - except KeyError: - raise ValidationError(_("no user uuid claim present in token")) - except User.DoesNotExist: - raise ValidationError(_("user does not exist")) + except KeyError as ke: + raise ValidationError(_("no user uuid claim present in token")) from ke + except User.DoesNotExist as dne: + raise ValidationError(_("user does not exist")) from dne - attrs["user"] = UserSerializer(user).data # type: ignore + # noinspection PyTypeChecker + attrs["user"] = UserSerializer(user).data return attrs diff --git a/vibes_auth/utils/emailing.py b/vibes_auth/utils/emailing.py index 55949924..de97955f 100644 --- a/vibes_auth/utils/emailing.py +++ b/vibes_auth/utils/emailing.py @@ -52,7 +52,7 @@ def send_verification_email_task(user_pk: str) -> tuple[bool, str]: return False, f"Something went wrong while sending an email: {e!s}" else: - return True, user.uuid + return True, str(user.uuid) @shared_task(queue="default") @@ -95,4 +95,4 @@ def send_reset_password_email_task(user_pk: str) -> tuple[bool, str]: return False, f"Something went wrong while sending an email: {e!s}" else: - return True, user.uuid + return True, str(user.uuid) diff --git a/vibes_auth/views.py b/vibes_auth/views.py index 0384d485..18f8b1c5 100644 --- a/vibes_auth/views.py +++ b/vibes_auth/views.py @@ -47,8 +47,8 @@ class TokenObtainPairView(TokenViewBase): subject to rate limiting depending on the global DEBUG setting. """ - serializer_class = TokenObtainPairSerializer # type: ignore - _serializer_class = TokenObtainPairSerializer # type: ignore + serializer_class = TokenObtainPairSerializer + _serializer_class = TokenObtainPairSerializer @method_decorator(ratelimit(key="ip", rate="10/h" if not DEBUG else "888/h")) def post(self, request, *args, **kwargs): @@ -82,8 +82,8 @@ class TokenRefreshView(TokenViewBase): whether the application is in DEBUG mode or not. """ - serializer_class = TokenRefreshSerializer # type: ignore - _serializer_class = TokenRefreshSerializer # type: ignore + serializer_class = TokenRefreshSerializer + _serializer_class = TokenRefreshSerializer @method_decorator(ratelimit(key="ip", rate="10/h" if not DEBUG else "888/h")) def post(self, request, *args, **kwargs): @@ -104,8 +104,8 @@ class TokenVerifyView(TokenViewBase): error response. """ - serializer_class = TokenVerifySerializer # type: ignore - _serializer_class = TokenVerifySerializer # type: ignore + serializer_class = TokenVerifySerializer + _serializer_class = TokenVerifySerializer def post(self, request, *args, **kwargs): try: