Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
KingCSharp committed Mar 9, 2022
1 parent fd4342d commit 1001774
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
8 changes: 7 additions & 1 deletion accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
13 changes: 10 additions & 3 deletions contacts/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -412,7 +421,6 @@ def post(self, request, pk, **kwargs):
)
return Response(context)


class ContactCommentView(APIView):
model = Comment
authentication_classes = (JSONWebTokenAuthentication,)
Expand Down Expand Up @@ -473,7 +481,6 @@ def delete(self, request, pk, format=None):
status=status.HTTP_403_FORBIDDEN,
)


class ContactAttachmentView(APIView):
model = Attachments
authentication_classes = (JSONWebTokenAuthentication,)
Expand Down
10 changes: 8 additions & 2 deletions leads/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion opportunity/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1001774

Please sign in to comment.