Skip to content

Commit

Permalink
Merge pull request #146 from gaiaresources/2756-amend-renew-status
Browse files Browse the repository at this point in the history
Changes to licence status for when it's renewed/amended.
  • Loading branch information
serge-gaia committed Feb 28, 2017
2 parents 373c67e + d81bc63 commit edd7b4e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions wildlifelicensing/apps/dashboard/views/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ def _render_status(instance):
application = Application.objects.get(licence=instance)
replacing_application = Application.objects.get(previous_application=application)

if replacing_application.is_licence_amendment:
return 'Amended'
else:
return 'Renewed'
if replacing_application.licence is not None:
if replacing_application.is_licence_amendment:
return 'Amended'
else:
return 'Renewed'
except Application.DoesNotExist:
pass

Expand All @@ -330,7 +331,13 @@ def _render_status(instance):
def _render_action(instance):
try:
application = Application.objects.get(licence=instance)
if Application.objects.filter(previous_application=application).exists():
replacing_application = Application.objects.get(previous_application=application)
if replacing_application.licence is None:
if replacing_application.is_licence_amendment:
return 'Amendment Pending'
else:
return 'Renewal Pending'
else:
return 'N/A'
except Application.DoesNotExist:
pass
Expand Down

0 comments on commit edd7b4e

Please sign in to comment.