Skip to content

Commit fca8b30

Browse files
committed
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
1 parent b2f8368 commit fca8b30

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

ietf/proceedings/models.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.db import models
22
from ietf.idtracker.models import Acronym, PersonOrOrgInfo, IRTF, AreaGroup, GroupIETF
33
import datetime
4+
from ietf.utils import log
45

56
# group_acronym is either an IETF Acronym
67
# or an IRTF one, depending on the value of irtf.
@@ -35,14 +36,17 @@ def acronym_name(self):
3536
return acronym_name
3637
def area(self):
3738
try:
38-
interim = self.interim
39+
irtf = self.irtf
3940
except AttributeError:
40-
interim = False
41-
if self.irtf:
41+
irtf = False
42+
if irtf:
4243
area = "IRTF"
4344
else:
44-
area = AreaGroup.objects.get(group=self.group_acronym_id).area
45-
return area
45+
try:
46+
area = AreaGroup.objects.get(group=self.group_acronym_id).area.area_acronym.acronym
47+
except:
48+
area = "???"
49+
return area
4650

4751
class Meeting(models.Model):
4852
meeting_num = models.IntegerField(primary_key=True)

0 commit comments

Comments
 (0)