contract create apis is done
This commit is contained in:
@@ -27,13 +27,13 @@ DJANGO_APPS = [
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
]
|
]
|
||||||
|
|
||||||
DJANGO_UNFOLD = [
|
# DJANGO_UNFOLD = [
|
||||||
"unfold",
|
# "unfold",
|
||||||
"unfold.contrib.filters",
|
# "unfold.contrib.filters",
|
||||||
"unfold.contrib.forms",
|
# "unfold.contrib.forms",
|
||||||
"unfold.contrib.guardian",
|
# "unfold.contrib.guardian",
|
||||||
"unfold.contrib.simple_history",
|
# "unfold.contrib.simple_history",
|
||||||
]
|
# ]
|
||||||
|
|
||||||
APPS = [
|
APPS = [
|
||||||
'core.apps.shared',
|
'core.apps.shared',
|
||||||
@@ -49,7 +49,7 @@ PACKAGES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = []
|
INSTALLED_APPS = []
|
||||||
INSTALLED_APPS += DJANGO_UNFOLD
|
# INSTALLED_APPS += DJANGO_UNFOLD
|
||||||
INSTALLED_APPS += DJANGO_APPS
|
INSTALLED_APPS += DJANGO_APPS
|
||||||
INSTALLED_APPS += PACKAGES
|
INSTALLED_APPS += PACKAGES
|
||||||
INSTALLED_APPS += APPS
|
INSTALLED_APPS += APPS
|
||||||
@@ -151,4 +151,4 @@ from config.conf.rest_framework import *
|
|||||||
from config.conf.simplejwt import *
|
from config.conf.simplejwt import *
|
||||||
from config.conf.celery import *
|
from config.conf.celery import *
|
||||||
from config.conf.redis import *
|
from config.conf.redis import *
|
||||||
from config.conf.unfold import *
|
# from config.conf.unfold import *
|
||||||
@@ -48,6 +48,7 @@ class ConfirUserApiView(generics.GenericAPIView):
|
|||||||
return Response({"success": True, "message": "code is expired"}, status=status.HTTP_400_BAD_REQUEST)
|
return Response({"success": True, "message": "code is expired"}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
if code.is_verify:
|
if code.is_verify:
|
||||||
return Response({"success": True, "message": "code is verified"}, status=status.HTTP_400_BAD_REQUEST)
|
return Response({"success": True, "message": "code is verified"}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
user.is_active = True
|
||||||
user.save()
|
user.save()
|
||||||
code.is_verify = True
|
code.is_verify = True
|
||||||
code.is_expired = True
|
code.is_expired = True
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ContractCreateSerializer(serializers.Serializer):
|
|||||||
add_folder=validated_data.pop('add_folder'),
|
add_folder=validated_data.pop('add_folder'),
|
||||||
add_notification=validated_data.pop('add_notification'),
|
add_notification=validated_data.pop('add_notification'),
|
||||||
)
|
)
|
||||||
return contract
|
return contract.id
|
||||||
|
|
||||||
|
|
||||||
class ContractListSerializer(serializers.ModelSerializer):
|
class ContractListSerializer(serializers.ModelSerializer):
|
||||||
|
|||||||
@@ -14,10 +14,21 @@ class ContractCreateApiView(generics.CreateAPIView):
|
|||||||
def get_serializer_context(self):
|
def get_serializer_context(self):
|
||||||
return {'user': self.request.user}
|
return {'user': self.request.user}
|
||||||
|
|
||||||
|
def create(self, request, *args, **kwargs):
|
||||||
|
serializer = self.get_serializer(data=request.data)
|
||||||
|
serializer.is_valid(raise_exception=True)
|
||||||
|
contract = serializer.save()
|
||||||
|
|
||||||
|
return Response({
|
||||||
|
"success": True,
|
||||||
|
"message": "Contract successfully created",
|
||||||
|
"contract_id": str(contract)
|
||||||
|
}, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
|
||||||
class ContractListApiView(generics.ListAPIView):
|
class ContractListApiView(generics.ListAPIView):
|
||||||
serializer_class = contract_serializer.ContractListSerializer
|
serializer_class = contract_serializer.ContractListSerializer
|
||||||
queryset = Contract.objects.all()
|
queryset = Contract.objects.all()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super().get_queryset()
|
return Contract.objects.filter(contract_sides__user=self.request.user)
|
||||||
|
|||||||
Reference in New Issue
Block a user