diff --git a/accounts/views.py b/accounts/views.py index 6b77ef3..8193521 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -25,7 +25,7 @@ from tasks.serializer import TaskSerializer from opportunity.serializer import OpportunitySerializer from invoices.serializer import InvoiceSerailizer -from accounts.serializer import EmailSerializer +from accounts.serializer import EmailSerializer,TagsSerailizer from teams.models import Teams from rest_framework import status @@ -113,6 +113,12 @@ def get_context_data(self, **kwargs): "close_accounts": accounts_close, } context["industries"] = INDCHOICES + + tags = Tags.objects.all() + tags=TagsSerailizer(tags,many=True).data + + context['tags']=tags + return context @swagger_auto_schema( diff --git a/contacts/views.py b/contacts/views.py index c973067..f620071 100644 --- a/contacts/views.py +++ b/contacts/views.py @@ -1,5 +1,5 @@ from rest_framework import status -from common.models import Attachments, Comment +from common.models import Attachments, Comment, Profile from contacts.models import Contact, Profile from teams.models import Teams from django.db.models import Q @@ -41,6 +41,7 @@ def get_context_data(self, **kwargs): Q(assigned_to__in=[self.request.profile]) | Q( created_by=self.request.profile) ).distinct() + if params: if params.get("name"): queryset = queryset.filter( @@ -81,6 +82,12 @@ def get_context_data(self, **kwargs): context["contact_obj_list"] = contacts context["countries"] = COUNTRIES context["per_page"] = params.get("per_page") + users = Profile.objects.filter(is_active=True, org=self.request.org).values( + "id", + "user__email" + ) + context["users"]=users + return context @swagger_auto_schema( @@ -93,6 +100,7 @@ def get(self, request, *args, **kwargs): @swagger_auto_schema( tags=["contacts"], manual_parameters=swagger_params.contact_create_post_params ) + def post(self, request, *args, **kwargs): params = request.query_params if len( request.data) == 0 else request.data @@ -192,6 +200,7 @@ def put(self, request, pk, format=None): data, status=status.HTTP_400_BAD_REQUEST, ) + if contact_serializer.is_valid(): if self.request.profile.role != "ADMIN" and not self.request.profile.is_admin: @@ -412,7 +421,6 @@ def post(self, request, pk, **kwargs): ) return Response(context) - class ContactCommentView(APIView): model = Comment authentication_classes = (JSONWebTokenAuthentication,) @@ -473,7 +481,6 @@ def delete(self, request, pk, format=None): status=status.HTTP_403_FORBIDDEN, ) - class ContactAttachmentView(APIView): model = Attachments authentication_classes = (JSONWebTokenAuthentication,) diff --git a/leads/views.py b/leads/views.py index 1433327..f3acf1b 100644 --- a/leads/views.py +++ b/leads/views.py @@ -14,7 +14,7 @@ ) from leads.models import Lead, Company from leads.forms import LeadListForm -from leads.serializer import LeadSerializer, LeadCreateSerializer, CompanySerializer +from leads.serializer import LeadSerializer, LeadCreateSerializer, CompanySerializer, TagsSerializer from leads.tasks import ( create_lead_from_file, send_email_to_assigned_user, @@ -123,7 +123,6 @@ def get_context_data(self, **kwargs): "close_leads": close_leads, "offset": offset } - contacts = Contact.objects.filter(org=self.request.org).values( "id", "first_name" @@ -133,6 +132,12 @@ def get_context_data(self, **kwargs): context["source"] = LEAD_SOURCE context["companies"] = CompanySerializer( Company.objects.filter(org=self.request.org), many=True).data + context["tags"] = TagsSerializer(Tags.objects.all(),many=True).data + + users = Profile.objects.filter(is_active=True, org=self.request.org).values( + "id", + "user__email") + context["users"]=users context["countries"] = COUNTRIES context["industries"] = INDCHOICES return context @@ -211,6 +216,7 @@ def post(self, request, *args, **kwargs): website=params.get("website"), org=request.org ) + account_object.billing_address_line = lead_obj.address_line account_object.billing_street = lead_obj.street account_object.billing_city = lead_obj.city diff --git a/opportunity/views.py b/opportunity/views.py index d0d3bb7..12b4de6 100644 --- a/opportunity/views.py +++ b/opportunity/views.py @@ -7,7 +7,7 @@ OpportunityCreateSerializer, ) from accounts.models import Account, Tags -from accounts.serializer import AccountSerializer +from accounts.serializer import AccountSerializer, TagsSerailizer from common.models import Attachments, Comment, Profile from common.custom_auth import JSONWebTokenAuthentication from common.serializer import ( @@ -101,6 +101,7 @@ def get_context_data(self, **kwargs): context["opportunities"] = opportunities context["accounts_list"] = AccountSerializer(accounts, many=True).data context["contacts_list"] = ContactSerializer(contacts, many=True).data + context['tags'] = TagsSerailizer(Tags.objects.filter(),many=True).data context["stage"] = STAGES context["lead_source"] = SOURCES context["currency"] = CURRENCY_CODES