fix: sorted imports
This commit is contained in:
+3
-12
@@ -1,18 +1,9 @@
|
||||
from django.contrib import admin
|
||||
from shop.models import (
|
||||
Product,
|
||||
ProductPrice,
|
||||
OrderLine,
|
||||
Order,
|
||||
Tax,
|
||||
Customer,
|
||||
Provider,
|
||||
Tag,
|
||||
ProductBatch,
|
||||
Brand,
|
||||
)
|
||||
from unfold.admin import ModelAdmin
|
||||
|
||||
from shop.models import (Brand, Customer, Order, OrderLine, Product,
|
||||
ProductBatch, ProductPrice, Provider, Tag, Tax)
|
||||
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Product)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from rest_framework.permissions import BasePermission
|
||||
|
||||
from config.api.v1.mixins import CRUDPermissionsMixin
|
||||
|
||||
|
||||
|
||||
+5
-12
@@ -1,17 +1,10 @@
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from shop.api.v1.viewsets import (
|
||||
TaxViewSet,
|
||||
CustomerViewSet,
|
||||
ProductViewSet,
|
||||
ProductPriceViewSet,
|
||||
OrderViewSet,
|
||||
OrderLineViewSet,
|
||||
ProviderViewSet,
|
||||
ProductBatchViewSet,
|
||||
TagViewSet,
|
||||
BrandViewSet,
|
||||
)
|
||||
|
||||
from shop.api.v1.viewsets import (BrandViewSet, CustomerViewSet,
|
||||
OrderLineViewSet, OrderViewSet,
|
||||
ProductBatchViewSet, ProductPriceViewSet,
|
||||
ProductViewSet, ProviderViewSet, TagViewSet,
|
||||
TaxViewSet)
|
||||
|
||||
app_name = "shop"
|
||||
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
from django.utils import timezone
|
||||
from rest_framework import serializers
|
||||
|
||||
from files.api.v1.serializers import FileUploadSerializer, NoIDFileUploadSerializer
|
||||
from shop.models import (
|
||||
Product,
|
||||
ProductPrice,
|
||||
Customer,
|
||||
Tax,
|
||||
OrderLine,
|
||||
Order,
|
||||
ProductBatch,
|
||||
Provider,
|
||||
Tag,
|
||||
Brand,
|
||||
)
|
||||
from files.api.v1.serializers import (FileUploadSerializer,
|
||||
NoIDFileUploadSerializer)
|
||||
from shop.models import (Brand, Customer, Order, OrderLine, Product,
|
||||
ProductBatch, ProductPrice, Provider, Tag, Tax)
|
||||
|
||||
|
||||
class TaxSerializer(serializers.ModelSerializer):
|
||||
|
||||
+16
-35
@@ -1,45 +1,26 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from django.db.models.deletion import ProtectedError
|
||||
from django.utils.text import gettext_lazy as _
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.db import transaction
|
||||
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
from django.db.models.deletion import ProtectedError
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.text import gettext_lazy as _
|
||||
from rest_framework.exceptions import ValidationError
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
|
||||
from shop.filters import ProductFilter
|
||||
from shop.api.v1.serializers import (
|
||||
ProductSerializer,
|
||||
ProductPriceSerializer,
|
||||
CustomerSerializer,
|
||||
TaxSerializer,
|
||||
OrderSerializer,
|
||||
OrderLineSerializer,
|
||||
ProviderSerializer,
|
||||
ProductBatchSerializer,
|
||||
CreateProductSerializer,
|
||||
CreateProductPriceSerializer,
|
||||
TagSerializer,
|
||||
ListProductSerializer,
|
||||
UpdateProductSerializer,
|
||||
BrandSerializer,
|
||||
)
|
||||
from shop.models import (
|
||||
Product,
|
||||
ProductPrice,
|
||||
Customer,
|
||||
Tax,
|
||||
Order,
|
||||
OrderLine,
|
||||
Provider,
|
||||
ProductBatch,
|
||||
Tag,
|
||||
Brand,
|
||||
)
|
||||
from rest_framework.viewsets import ModelViewSet
|
||||
|
||||
from shop.api.v1.permissions import ProductPermissions, ProductPricePermissions
|
||||
from shop.api.v1.serializers import (BrandSerializer,
|
||||
CreateProductPriceSerializer,
|
||||
CreateProductSerializer,
|
||||
CustomerSerializer, ListProductSerializer,
|
||||
OrderLineSerializer, OrderSerializer,
|
||||
ProductBatchSerializer,
|
||||
ProductPriceSerializer, ProductSerializer,
|
||||
ProviderSerializer, TagSerializer,
|
||||
TaxSerializer, UpdateProductSerializer)
|
||||
from shop.filters import ProductFilter
|
||||
from shop.models import (Brand, Customer, Order, OrderLine, Product,
|
||||
ProductBatch, ProductPrice, Provider, Tag, Tax)
|
||||
from shop.utils import delete_product_batch
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
from django.utils.text import gettext_lazy as _
|
||||
import django_filters
|
||||
from django.utils.text import gettext_lazy as _
|
||||
|
||||
from shop.models import Product
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-21 17:19
|
||||
|
||||
import uuid
|
||||
from decimal import Decimal
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import uuid
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-02 19:47
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from config.tests.mixins import TestUserAuthenticationMixin
|
||||
from shop.models import Product, ProductPrice, Tax, Customer
|
||||
from shop.models import Customer, Product, ProductPrice, Tax
|
||||
|
||||
|
||||
class TestOrdersAPI(APITestCase, TestUserAuthenticationMixin):
|
||||
|
||||
@@ -2,12 +2,12 @@ import random
|
||||
import string
|
||||
from decimal import Decimal
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
from django.utils import timezone
|
||||
|
||||
from config.tests.mixins import TestUserAuthenticationMixin
|
||||
from shop.models import Product, ProductPrice, Tax, ProductBatch, Tag
|
||||
from shop.models import Product, ProductBatch, ProductPrice, Tag, Tax
|
||||
|
||||
|
||||
class TestProductsAPI(APITestCase, TestUserAuthenticationMixin):
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from rest_framework.test import APITestCase as TestCase
|
||||
from shop.models import Product, ProductPrice, Tax, Customer
|
||||
from shop.utils import create_order_line_for_product, create_order
|
||||
|
||||
from shop.models import Customer, Product, ProductPrice, Tax
|
||||
from shop.utils import create_order, create_order_line_for_product
|
||||
|
||||
|
||||
class ShopModelsTest(TestCase):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.urls import path
|
||||
|
||||
from shop.views import index, list_products, product_detail
|
||||
|
||||
app_name = "shop"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from shop.models import OrderLine, Product, Order, Customer, ProductBatch
|
||||
from shop.models import Customer, Order, OrderLine, Product, ProductBatch
|
||||
|
||||
|
||||
def create_order_line_for_product(product: Product, quantity: Decimal, order: Order):
|
||||
|
||||
+2
-4
@@ -1,11 +1,9 @@
|
||||
from django.views.generic import TemplateView
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.core.paginator import Paginator
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from shop.filters import ProductFilter
|
||||
from shop.models import Product
|
||||
|
||||
from shop.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||
from shop.models import Product
|
||||
|
||||
|
||||
class IndexView(TemplateView):
|
||||
|
||||
Reference in New Issue
Block a user