fix: sorted imports
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from django.urls import path, include
|
from django.urls import include, path
|
||||||
from drf_spectacular.views import SpectacularSwaggerView, SpectacularRedocView
|
from drf_spectacular.views import SpectacularRedocView, SpectacularSwaggerView
|
||||||
|
|
||||||
from config.api.v1.views import APISchema
|
from config.api.v1.views import APISchema
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
|
||||||
# set the default Django settings module for the 'celery' program.
|
# set the default Django settings module for the 'celery' program.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from config.settings.environ import * # noqa
|
from config.settings.environ import * # noqa
|
||||||
|
|
||||||
APP_NAME = "Shop"
|
APP_NAME = "Shop"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import environ
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import environ
|
||||||
|
|
||||||
BASE_DIR = Path(".")
|
BASE_DIR = Path(".")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import string
|
|
||||||
import random
|
import random
|
||||||
from django.contrib.auth.models import User, Permission
|
import string
|
||||||
|
|
||||||
|
from django.contrib.auth.models import Permission, User
|
||||||
|
|
||||||
|
|
||||||
class TestUserAuthenticationMixin:
|
class TestUserAuthenticationMixin:
|
||||||
|
|||||||
+1
-2
@@ -2,8 +2,7 @@ import debug_toolbar
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import include, path
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include("shop.urls")),
|
path("", include("shop.urls")),
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from rest_framework.routers import DefaultRouter
|
|||||||
|
|
||||||
from files.api.v1.views import FileUploadViewSet
|
from files.api.v1.views import FileUploadViewSet
|
||||||
|
|
||||||
|
|
||||||
app_name = "files"
|
app_name = "files"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
|
|
||||||
from files.api.v1.serializers import FileUploadSerializer
|
from files.api.v1.serializers import FileUploadSerializer
|
||||||
from files.models import FileUpload
|
from files.models import FileUpload
|
||||||
|
|
||||||
|
|||||||
+3
-12
@@ -1,18 +1,9 @@
|
|||||||
from django.contrib import admin
|
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 unfold.admin import ModelAdmin
|
||||||
|
|
||||||
|
from shop.models import (Brand, Customer, Order, OrderLine, Product,
|
||||||
|
ProductBatch, ProductPrice, Provider, Tag, Tax)
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
@admin.register(Product)
|
@admin.register(Product)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from rest_framework.permissions import BasePermission
|
from rest_framework.permissions import BasePermission
|
||||||
|
|
||||||
from config.api.v1.mixins import CRUDPermissionsMixin
|
from config.api.v1.mixins import CRUDPermissionsMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-12
@@ -1,17 +1,10 @@
|
|||||||
from rest_framework.routers import DefaultRouter
|
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"
|
app_name = "shop"
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,10 @@
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from files.api.v1.serializers import FileUploadSerializer, NoIDFileUploadSerializer
|
from files.api.v1.serializers import (FileUploadSerializer,
|
||||||
from shop.models import (
|
NoIDFileUploadSerializer)
|
||||||
Product,
|
from shop.models import (Brand, Customer, Order, OrderLine, Product,
|
||||||
ProductPrice,
|
ProductBatch, ProductPrice, Provider, Tag, Tax)
|
||||||
Customer,
|
|
||||||
Tax,
|
|
||||||
OrderLine,
|
|
||||||
Order,
|
|
||||||
ProductBatch,
|
|
||||||
Provider,
|
|
||||||
Tag,
|
|
||||||
Brand,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TaxSerializer(serializers.ModelSerializer):
|
class TaxSerializer(serializers.ModelSerializer):
|
||||||
|
|||||||
+16
-35
@@ -1,45 +1,26 @@
|
|||||||
from decimal import Decimal
|
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 django.db import transaction
|
||||||
|
from django.db.models.deletion import ProtectedError
|
||||||
from rest_framework.viewsets import ModelViewSet
|
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.exceptions import ValidationError
|
||||||
from rest_framework.permissions import IsAdminUser
|
from rest_framework.permissions import IsAdminUser
|
||||||
|
from rest_framework.viewsets import ModelViewSet
|
||||||
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 shop.api.v1.permissions import ProductPermissions, ProductPricePermissions
|
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
|
from shop.utils import delete_product_batch
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
from django.utils.text import gettext_lazy as _
|
|
||||||
import django_filters
|
import django_filters
|
||||||
|
from django.utils.text import gettext_lazy as _
|
||||||
|
|
||||||
from shop.models import Product
|
from shop.models import Product
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-05-21 17:19
|
# 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.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
import uuid
|
|
||||||
from decimal import Decimal
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-02 19:47
|
# Generated by Django 5.0.6 on 2024-06-02 19:47
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
from decimal import Decimal
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from rest_framework import status
|
|||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from config.tests.mixins import TestUserAuthenticationMixin
|
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):
|
class TestOrdersAPI(APITestCase, TestUserAuthenticationMixin):
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import random
|
|||||||
import string
|
import string
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from django.utils import timezone
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
from config.tests.mixins import TestUserAuthenticationMixin
|
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):
|
class TestProductsAPI(APITestCase, TestUserAuthenticationMixin):
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from rest_framework.test import APITestCase as TestCase
|
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):
|
class ShopModelsTest(TestCase):
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from shop.views import index, list_products, product_detail
|
from shop.views import index, list_products, product_detail
|
||||||
|
|
||||||
app_name = "shop"
|
app_name = "shop"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
from decimal import Decimal
|
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):
|
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.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.filters import ProductFilter
|
||||||
from shop.models import Product
|
|
||||||
|
|
||||||
from shop.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
from shop.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||||
|
from shop.models import Product
|
||||||
|
|
||||||
|
|
||||||
class IndexView(TemplateView):
|
class IndexView(TemplateView):
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from tpv.models import PaymentTransaction
|
|
||||||
from unfold.admin import ModelAdmin
|
from unfold.admin import ModelAdmin
|
||||||
|
|
||||||
|
from tpv.models import PaymentTransaction
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
@admin.register(PaymentTransaction)
|
@admin.register(PaymentTransaction)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-05-21 17:19
|
# Generated by Django 5.0.6 on 2024-05-21 17:19
|
||||||
|
|
||||||
import tpv.models
|
|
||||||
import uuid
|
import uuid
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import tpv.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import gettext_lazy as _
|
from django.utils.text import gettext_lazy as _
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -1,15 +1,14 @@
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import requests
|
|
||||||
|
|
||||||
|
import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from tpv.models import PaymentTransaction
|
|
||||||
from tpv.utils import compute_signature, decode_b64_dict
|
|
||||||
from tpv.settings import TransactionTypes
|
|
||||||
|
|
||||||
from tpv.exceptions import RedsysPaymentException
|
from tpv.exceptions import RedsysPaymentException
|
||||||
|
from tpv.models import PaymentTransaction
|
||||||
|
from tpv.settings import TransactionTypes
|
||||||
|
from tpv.utils import compute_signature, decode_b64_dict
|
||||||
|
|
||||||
|
|
||||||
class RedsysClient:
|
class RedsysClient:
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from django.dispatch import Signal
|
from django.dispatch import Signal
|
||||||
|
|
||||||
|
|
||||||
redsys_payment_accepted = Signal()
|
redsys_payment_accepted = Signal()
|
||||||
redsys_payment_rejected = Signal()
|
redsys_payment_rejected = Signal()
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils import timezone
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
from django.conf import settings
|
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
from tpv.models import PaymentTransaction
|
from tpv.models import PaymentTransaction
|
||||||
from tpv.redsys import RedsysClient
|
from tpv.redsys import RedsysClient
|
||||||
from tpv.settings import ERROR_CODES
|
from tpv.settings import ERROR_CODES
|
||||||
|
|
||||||
from tpv.utils import validate_expiry_date
|
from tpv.utils import validate_expiry_date
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-7
@@ -1,11 +1,7 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from tpv.views import (
|
|
||||||
transaction_created,
|
from tpv.views import (payment_accepted, payment_form, payment_rejected,
|
||||||
webhook,
|
transaction_created, webhook)
|
||||||
payment_accepted,
|
|
||||||
payment_rejected,
|
|
||||||
payment_form,
|
|
||||||
)
|
|
||||||
|
|
||||||
app_name = "tpv"
|
app_name = "tpv"
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -2,15 +2,14 @@ import base64
|
|||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
import pyDes
|
import pyDes
|
||||||
import re
|
|
||||||
|
|
||||||
from decimal import Decimal
|
|
||||||
from django.utils.text import gettext_lazy as _
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.text import gettext_lazy as _
|
||||||
|
|
||||||
from tpv.exceptions import RedsysValidationException, RedsysPaymentException
|
from tpv.exceptions import RedsysPaymentException, RedsysValidationException
|
||||||
from tpv.models import PaymentTransaction
|
from tpv.models import PaymentTransaction
|
||||||
from tpv.settings import ERROR_CODES
|
from tpv.settings import ERROR_CODES
|
||||||
from tpv.signals import redsys_payment_accepted
|
from tpv.signals import redsys_payment_accepted
|
||||||
|
|||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
|
from django.http.response import HttpResponse
|
||||||
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.shortcuts import render, get_object_or_404, redirect
|
|
||||||
from django.http.response import HttpResponse
|
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
from tpv.forms import UpdateEmailForm
|
from tpv.forms import UpdateEmailForm
|
||||||
from tpv.models import PaymentTransaction
|
from tpv.models import PaymentTransaction
|
||||||
from tpv.redsys import RedsysClient
|
from tpv.redsys import RedsysClient
|
||||||
from tpv.utils import pay_transaction, validate_payment_for_transaction
|
|
||||||
from tpv.signals import redsys_payment_accepted, redsys_payment_rejected
|
from tpv.signals import redsys_payment_accepted, redsys_payment_rejected
|
||||||
|
from tpv.utils import pay_transaction, validate_payment_for_transaction
|
||||||
|
|
||||||
|
|
||||||
def payment_accepted(request, transaction):
|
def payment_accepted(request, transaction):
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ from typing import List
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.password_validation import (
|
from django.contrib.auth.password_validation import (get_password_validators,
|
||||||
get_password_validators,
|
validate_password)
|
||||||
validate_password,
|
|
||||||
)
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.exceptions import ValidationError
|
from rest_framework.exceptions import ValidationError
|
||||||
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from users.api.v1.views import retrieve_update_me, change_password
|
from rest_framework_simplejwt.views import (token_obtain_pair, token_refresh,
|
||||||
|
token_verify)
|
||||||
from rest_framework_simplejwt.views import (
|
|
||||||
token_refresh,
|
|
||||||
token_obtain_pair,
|
|
||||||
token_verify,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
from users.api.v1.views import change_password, retrieve_update_me
|
||||||
|
|
||||||
app_name = "auth"
|
app_name = "auth"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from django.contrib.auth.models import User
|
|||||||
from rest_framework.generics import RetrieveUpdateAPIView, UpdateAPIView
|
from rest_framework.generics import RetrieveUpdateAPIView, UpdateAPIView
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
|
||||||
from users.api.v1.serializers import UserSerializer, UpdatePasswordSerializer
|
from users.api.v1.serializers import UpdatePasswordSerializer, UserSerializer
|
||||||
|
|
||||||
|
|
||||||
class RetrieveUpdateMe(RetrieveUpdateAPIView):
|
class RetrieveUpdateMe(RetrieveUpdateAPIView):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from django.utils.text import gettext_lazy as _
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.forms import AuthenticationForm, UsernameField
|
from django.contrib.auth.forms import AuthenticationForm, UsernameField
|
||||||
|
from django.utils.text import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(AuthenticationForm):
|
class LoginForm(AuthenticationForm):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from rest_framework import status
|
|
||||||
from rest_framework.test import APITestCase
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from rest_framework import status
|
|
||||||
from rest_framework.test import APITestCase
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from rest_framework import status
|
|
||||||
from rest_framework.test import APITestCase
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from users.views import login, logout, register, reset_password
|
from users.views import login, logout, register, reset_password
|
||||||
|
|
||||||
app_name = "users"
|
app_name = "users"
|
||||||
|
|||||||
+4
-2
@@ -1,7 +1,9 @@
|
|||||||
|
from django.contrib.auth import login as login_user
|
||||||
|
from django.contrib.auth import logout as logout_user
|
||||||
|
from django.shortcuts import redirect, render, reverse
|
||||||
from django.views.generic import TemplateView, View
|
from django.views.generic import TemplateView, View
|
||||||
from django.shortcuts import render, reverse, redirect
|
|
||||||
from users.forms import LoginForm
|
from users.forms import LoginForm
|
||||||
from django.contrib.auth import login as login_user, logout as logout_user
|
|
||||||
|
|
||||||
|
|
||||||
class RedirectionMixin:
|
class RedirectionMixin:
|
||||||
|
|||||||
Reference in New Issue
Block a user