Skip to content

Commit e7e992b

Browse files
committed
Add proxy for AreaGroup
- Legacy-Id: 3791
1 parent 2f00c30 commit e7e992b

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

ietf/idtracker/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,9 +1154,10 @@ def __init__(self, document):
11541154
IESGLoginOld = IESGLogin
11551155
IETFWGOld = IETFWG
11561156
IRTFOld = IRTF
1157+
AreaGroupOld = AreaGroup
11571158
from redesign.doc.proxy import InternetDraft, IDInternal, BallotInfo, Rfc, IDState
11581159
from redesign.name.proxy import IDSubState
1159-
from redesign.group.proxy import Area, Acronym, IETFWG, IRTF
1160+
from redesign.group.proxy import Area, Acronym, IETFWG, IRTF, AreaGroup
11601161
from redesign.person.proxy import IESGLogin
11611162

11621163

redesign/group/proxy.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ def last_modified_date(self):
161161
#area = FKAsOneToOne('areagroup', reverse=True)
162162
@property
163163
def area(self):
164-
class AreaGroup: pass
165164
if self.parent:
166-
areagroup = AreaGroup()
167-
areagroup.area = Area().from_object(self.parent)
165+
areagroup = AreaGroup().from_object(self)
168166
return areagroup
169167
else:
170168
return None
@@ -246,3 +244,20 @@ def __str__(self):
246244
# return IRTFChair.objects.filter(irtf=self)
247245
class Meta:
248246
proxy = True
247+
248+
class AreaGroup(Group):
249+
objects = TranslatingManager(dict(group="pk"),
250+
always_filter=dict(type="wg"))
251+
252+
def from_object(self, base):
253+
for f in base._meta.fields:
254+
setattr(self, f.name, getattr(base, f.name))
255+
return self
256+
257+
@property
258+
def area(self):
259+
return Area().from_object(self.parent)
260+
261+
@property
262+
def group(self):
263+
return self

0 commit comments

Comments
 (0)