Complete showing all data on case study view, closes #7
This commit is contained in:
@ -161,6 +161,8 @@ class CaseStudy(models.Model):
|
||||
('CORS', _('A case of responsible sourcing/supply chain/lifecycle management')),
|
||||
)
|
||||
|
||||
NEGATIVE_CASE_REASONS_OTHER_TEXT = _('Other reasons')
|
||||
|
||||
NEGATIVE_CASE_REASONS_CHOICES = (
|
||||
('VOLR', _('Violation of land rights')),
|
||||
('VOHR', _('Violation of fundamental human rights, indigenous rights and/or other collective rights')),
|
||||
@ -172,7 +174,7 @@ class CaseStudy(models.Model):
|
||||
etc')),
|
||||
('ALAB', _('Abusive labour practices')),
|
||||
('CRUP', _('Corruption and/or irregular permitting or contracting, conflicts of interest etc')),
|
||||
('OTHR', _('Other reasons'))
|
||||
('OTHR', NEGATIVE_CASE_REASONS_OTHER_TEXT)
|
||||
)
|
||||
|
||||
# Dynamically generate a list of choices 40 years prior and after the current year.
|
||||
@ -995,6 +997,15 @@ class CaseStudy(models.Model):
|
||||
"""Gets the 11 character YouTube video ID from the video field."""
|
||||
return parse.parse_qs(parse.urlparse(self.video).query)["v"][0]
|
||||
|
||||
def get_negative_case_reasons_no_other(self):
|
||||
"""Return a list of negative case reasons, minus the 'other' choice (if selected)"""
|
||||
choices = self.get_negative_case_reasons_list()
|
||||
|
||||
if choices.count(self.NEGATIVE_CASE_REASONS_OTHER_TEXT) > 0:
|
||||
choices.remove(self.NEGATIVE_CASE_REASONS_OTHER_TEXT)
|
||||
|
||||
return choices
|
||||
|
||||
def get_renewable_generation_detail(self):
|
||||
"""Prepend appropriate descriptive text when accessing renewable generation type."""
|
||||
|
||||
|
Reference in New Issue
Block a user