Skip to content

Commit

Permalink
Merge pull request #99 from ojonathacardoso/master
Browse files Browse the repository at this point in the history
Correção para correta adição dos cadastros de Contato
  • Loading branch information
ojonathacardoso authored Jul 7, 2022
2 parents dfc3bdb + 7b03ce0 commit 9f65e7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions saap/globalrules/crud_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,22 @@ def form_valid(self, form):

if self.container_field:
container = self.container_field.split('__')
print(getattr(self.model, container[0]).field.related_model)

if len(container) > 1:
#container_model = getattr(
# self.model, container[0]).field.related_model
container_model = getattr(
self.model, container[0]).field.related_model

#params = {}
#params['__'.join(
# container[1:])] = self.request.user.pk
params = {}
params['__'.join(
container[1:])] = self.request.user.pk

#if 'pk' in self.kwargs:
# params['pk'] = self.kwargs['pk']
if 'pk' in self.kwargs:
params['pk'] = self.kwargs['pk']

container_data = OperadorAreaTrabalho.objects.filter(user=self.request.user.pk, preferencial=True)[0].areatrabalho
#container_data = container_model.objects.filter(
# **params).first()
if str(container_model).find('AreaTrabalho') >= 0:
container_data = OperadorAreaTrabalho.objects.filter(user=self.request.user.pk, preferencial=True)[0].areatrabalho
else:
container_data = container_model.objects.filter(**params).first()

if not container_data:
raise Exception(
Expand Down
Binary file modified saap/static/img/brasao-camara.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9f65e7b

Please sign in to comment.