The 'area' returned from the AreaGroup.objects is itself a foreign key,
which means we need to look up area_acronym, but that's also a foreign key, so again we look up the value we want: acronym. Simply doing dictsort in the template on area would sort on the FK, I assume -- at least it didn't resolve things to 3 levels, each time looking up the key we were interested in... - Legacy-Id: 151
This commit is contained in:
parent
b2f8368971
commit
fca8b30b51
|
@ -1,6 +1,7 @@
|
|||
from django.db import models
|
||||
from ietf.idtracker.models import Acronym, PersonOrOrgInfo, IRTF, AreaGroup, GroupIETF
|
||||
import datetime
|
||||
from ietf.utils import log
|
||||
|
||||
# group_acronym is either an IETF Acronym
|
||||
# or an IRTF one, depending on the value of irtf.
|
||||
|
@ -35,14 +36,17 @@ class ResolveAcronym(object):
|
|||
return acronym_name
|
||||
def area(self):
|
||||
try:
|
||||
interim = self.interim
|
||||
irtf = self.irtf
|
||||
except AttributeError:
|
||||
interim = False
|
||||
if self.irtf:
|
||||
irtf = False
|
||||
if irtf:
|
||||
area = "IRTF"
|
||||
else:
|
||||
area = AreaGroup.objects.get(group=self.group_acronym_id).area
|
||||
return area
|
||||
try:
|
||||
area = AreaGroup.objects.get(group=self.group_acronym_id).area.area_acronym.acronym
|
||||
except:
|
||||
area = "???"
|
||||
return area
|
||||
|
||||
class Meeting(models.Model):
|
||||
meeting_num = models.IntegerField(primary_key=True)
|
||||
|
|
Loading…
Reference in a new issue