Skip to content

Commit

Permalink
Merge pull request #279 from wilsonc86/master
Browse files Browse the repository at this point in the history
WildlifeLicensing - more fixes for recursive assessment serialize
  • Loading branch information
dbca-asi authored Apr 23, 2018
2 parents d414d10 + 8e4fda5 commit 14e7837
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions wildlifelicensing/apps/applications/views/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_context_data(self, **kwargs):
kwargs['application'] = serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}})
kwargs['form_structure'] = application.licence_type.application_schema
kwargs['assessments'] = serialize(Assessment.objects.filter(application=application),
posthook=format_assessment)
posthook=format_assessment,exclude=['application','applicationrequest_ptr'])

kwargs['log_entry_form'] = ApplicationLogEntryForm(to=get_log_entry_to(application),
fromm=self.request.user.get_full_name())
Expand Down Expand Up @@ -97,10 +97,10 @@ def get_context_data(self, **kwargs):
kwargs['application'] = serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}})
kwargs['form_structure'] = application.licence_type.application_schema

kwargs['assessment'] = serialize(assessment, post_hook=format_assessment)
kwargs['assessment'] = serialize(assessment, post_hook=format_assessment,exclude=['application','applicationrequest_ptr'])

kwargs['other_assessments'] = serialize(Assessment.objects.filter(application=application).
exclude(id=assessment.id).order_by('id'), posthook=format_assessment)
exclude(id=assessment.id).order_by('id'), posthook=format_assessment,exclude=['application','applicationrequest_ptr'])

assessors = [{'id': assessor.id, 'text': assessor.get_full_name()} for assessor in
assessment.assessor_group.members.all().order_by('first_name')]
Expand Down
6 changes: 3 additions & 3 deletions wildlifelicensing/apps/applications/views/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def _build_data(self, request, application):
'form_structure': application.licence_type.application_schema,
'officers': officers,
'amendment_requests': serialize(AmendmentRequest.objects.filter(application=application),
posthook=format_amendment_request,exclude=['application','applicationrequest_ptr']),
posthook=format_amendment_request),
'assessor_groups': ass_groups,
'assessments': serialize(Assessment.objects.filter(application=application),
posthook=format_assessment),
posthook=format_assessment,exclude=['application','applicationrequest_ptr']),
'previous_versions': serialize(previous_lodgements),
'returns_outstanding': previous_application_returns_outstanding,
'payment_status': payment_utils.PAYMENT_STATUSES.get(payment_utils.
Expand Down Expand Up @@ -372,7 +372,7 @@ def post(self, request, *args, **kwargs):

assessment.save()

return JsonResponse({'assessment': serialize(assessment, posthook=format_assessment),
return JsonResponse({'assessment': serialize(assessment, posthook=format_assessment,exclude=['application','applicationrequest_ptr']),
'processing_status': PROCESSING_STATUSES[application.processing_status]},
safe=False, encoder=WildlifeLicensingJSONEncoder)

Expand Down
6 changes: 3 additions & 3 deletions wildlifelicensing/apps/applications/views/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_context_data(self, **kwargs):
kwargs['application'] = serialize(application, posthook=format_application)

kwargs['assessments'] = serialize(Assessment.objects.filter(application=application),
posthook=format_assessment)
posthook=format_assessment,exclude=['application','applicationrequest_ptr'])

kwargs['payment_status'] = payment_utils.PAYMENT_STATUSES.get(payment_utils.
get_application_payment_status(application))
Expand Down Expand Up @@ -114,10 +114,10 @@ def get_context_data(self, **kwargs):

assessment = get_object_or_404(Assessment, pk=self.args[1])

kwargs['assessment'] = serialize(assessment, post_hook=format_assessment)
kwargs['assessment'] = serialize(assessment, post_hook=format_assessment,exclude=['application','applicationrequest_ptr'])

kwargs['other_assessments'] = serialize(Assessment.objects.filter(application=application).
exclude(id=assessment.id).order_by('id'), posthook=format_assessment)
exclude(id=assessment.id).order_by('id'), posthook=format_assessment,exclude=['application','applicationrequest_ptr'])

kwargs['log_entry_form'] = ApplicationLogEntryForm(to=get_log_entry_to(application),
fromm=self.request.user.get_full_name())
Expand Down

0 comments on commit 14e7837

Please sign in to comment.