@@ -85,9 +85,13 @@ def get_context_data(self, **kwargs):
8585 if params .get ("search" ):
8686 queryset = queryset .filter (name__icontains = params .get ("search" ))
8787 if params .get ("created_at__gte" ):
88- queryset = queryset .filter (created_at__gte = params .get ("created_at__gte" ))
88+ queryset = queryset .filter (
89+ created_at__gte = params .get ("created_at__gte" )
90+ )
8991 if params .get ("created_at__lte" ):
90- queryset = queryset .filter (created_at__lte = params .get ("created_at__lte" ))
92+ queryset = queryset .filter (
93+ created_at__lte = params .get ("created_at__lte" )
94+ )
9195
9296 context = {}
9397
@@ -187,27 +191,33 @@ def post(self, request, *args, **kwargs):
187191
188192 # Handle M2M relationships using utilities
189193 handle_m2m_assignment (
190- account_object , 'contacts' , data .get ('contacts' ),
191- Contact , request .profile .org
194+ account_object ,
195+ "contacts" ,
196+ data .get ("contacts" ),
197+ Contact ,
198+ request .profile .org ,
192199 )
193- tags = get_or_create_tags (data .get (' tags' ), request .profile .org )
200+ tags = get_or_create_tags (data .get (" tags" ), request .profile .org )
194201 if tags :
195202 account_object .tags .add (* tags )
196203 handle_m2m_assignment (
197- account_object , 'teams' , data .get ('teams' ),
198- Teams , request .profile .org
204+ account_object , "teams" , data .get ("teams" ), Teams , request .profile .org
199205 )
200206 handle_m2m_assignment (
201- account_object , 'assigned_to' , data .get ('assigned_to' ),
202- Profile , request .profile .org , extra_filters = {'is_active' : True }
207+ account_object ,
208+ "assigned_to" ,
209+ data .get ("assigned_to" ),
210+ Profile ,
211+ request .profile .org ,
212+ extra_filters = {"is_active" : True },
203213 )
204214
205215 # Handle attachment
206216 if self .request .FILES .get ("account_attachment" ):
207217 create_attachment (
208218 request .FILES .get ("account_attachment" ),
209219 account_object ,
210- request .profile
220+ request .profile ,
211221 )
212222
213223 recipients = list (
@@ -286,7 +296,9 @@ def put(self, request, pk, format=None):
286296 account_object .tags .clear ()
287297 if data .get ("tags" ):
288298 tags = json .loads (data .get ("tags" ))
289- tag_objs = Tags .objects .filter (id__in = tags , org = request .profile .org , is_active = True )
299+ tag_objs = Tags .objects .filter (
300+ id__in = tags , org = request .profile .org , is_active = True
301+ )
290302 account_object .tags .add (* tag_objs )
291303
292304 account_object .teams .clear ()
@@ -546,7 +558,10 @@ def patch(self, request, pk, format=None):
546558 account_object = self .get_object (pk = pk )
547559 if account_object .org != request .profile .org :
548560 return Response (
549- {"error" : True , "errors" : "User company does not match with header...." },
561+ {
562+ "error" : True ,
563+ "errors" : "User company does not match with header...." ,
564+ },
550565 status = status .HTTP_403_FORBIDDEN ,
551566 )
552567 if self .request .profile .role != "ADMIN" and not self .request .profile .is_admin :
@@ -591,7 +606,9 @@ def patch(self, request, pk, format=None):
591606 if tags :
592607 if isinstance (tags , str ):
593608 tags = json .loads (tags )
594- tag_objs = Tags .objects .filter (id__in = tags , org = request .profile .org , is_active = True )
609+ tag_objs = Tags .objects .filter (
610+ id__in = tags , org = request .profile .org , is_active = True
611+ )
595612 account_object .tags .add (* tag_objs )
596613
597614 if "teams" in data :
@@ -600,7 +617,9 @@ def patch(self, request, pk, format=None):
600617 if teams_list :
601618 if isinstance (teams_list , str ):
602619 teams_list = json .loads (teams_list )
603- teams = Teams .objects .filter (id__in = teams_list , org = request .profile .org )
620+ teams = Teams .objects .filter (
621+ id__in = teams_list , org = request .profile .org
622+ )
604623 account_object .teams .add (* teams )
605624
606625 if "assigned_to" in data :
0 commit comments