Skip to content

Commit 4c9db8f

Browse files
committed
This is the first step towards using Role to represent Area directors. It
- Migrates the information captured in GroupInfo.ad to Role objects. - Renames GroupInfo.ad to GroupInfo._ad (retaining the current column name) to prepare for deletion of that field. - Provides ad property accessor and setter methods implemented using the group's role_set (so that the existing view code continues to work with minimal changes) - Improved selection in many querysets that assumed only groups of type 'area' would have area directors. Related to ietf-tools#1557 and ietf-tools#1555. Commit ready to merge. - Legacy-Id: 8851
1 parent 6f8f195 commit 4c9db8f

15 files changed

Lines changed: 346 additions & 21 deletions

File tree

ietf/doc/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, *args, **kwargs):
2121
from ietf.person.models import Person
2222

2323
class AdForm(forms.Form):
24-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
24+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type='area').order_by('name'),
2525
label="Shepherding AD", empty_label="(None)", required=True)
2626

2727
def __init__(self, *args, **kwargs):

ietf/doc/mails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def email_ballot_undeferred(request, doc, by, telechat_date):
326326
telechat_date=telechat_date))
327327

328328
def generate_issue_ballot_mail(request, doc, ballot):
329-
active_ads = Person.objects.filter(role__name="ad", role__group__state="active").distinct()
329+
active_ads = Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area").distinct()
330330

331331
positions = BallotPositionDocEvent.objects.filter(doc=doc, type="changed_ballot_position", ballot=ballot).order_by("-time", '-id').select_related('ad')
332332

ietf/doc/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ class BallotDocEvent(DocEvent):
721721

722722
def active_ad_positions(self):
723723
"""Return dict mapping each active AD to a current ballot position (or None if they haven't voted)."""
724-
active_ads = list(Person.objects.filter(role__name="ad", role__group__state="active"))
724+
active_ads = list(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area"))
725725
res = {}
726726

727727
positions = BallotPositionDocEvent.objects.filter(type="changed_ballot_position",ad__in=active_ads, ballot=self).select_related('ad', 'pos').order_by("-time", "-id")
@@ -740,7 +740,7 @@ def all_positions(self):
740740

741741
positions = []
742742
seen = {}
743-
active_ads = list(Person.objects.filter(role__name="ad", role__group__state="active").distinct())
743+
active_ads = list(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area").distinct())
744744
for e in BallotPositionDocEvent.objects.filter(type="changed_ballot_position", ballot=self).select_related('ad', 'pos').order_by("-time", '-id'):
745745
if e.ad not in seen:
746746
e.old_ad = e.ad not in active_ads

ietf/doc/utils_charter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def default_review_text(group, charter, by):
154154
return e
155155

156156
def generate_issue_ballot_mail(request, doc, ballot):
157-
active_ads = Person.objects.filter(email__role__name="ad", email__role__group__state="active").distinct()
157+
active_ads = Person.objects.filter(email__role__name="ad", email__role__group__state="active", email__role__group__type="area").distinct()
158158

159159
seen = []
160160
positions = []

ietf/doc/views_charter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def change_title(request, name, option=None):
280280
context_instance=RequestContext(request))
281281

282282
class AdForm(forms.Form):
283-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
283+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area").order_by('name'),
284284
label="Responsible AD", empty_label="(None)", required=True)
285285

286286
def __init__(self, *args, **kwargs):

ietf/doc/views_conflict_review.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class SimpleStartReviewForm(forms.Form):
327327
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
328328

329329
class StartReviewForm(forms.Form):
330-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
330+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active",role__group__type='area').order_by('name'),
331331
label="Shepherding AD", empty_label="(None)", required=True)
332332
create_in_state = forms.ModelChoiceField(State.objects.filter(used=True, type="conflrev", slug__in=("needshep", "adrev")), empty_label=None, required=False)
333333
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)

ietf/doc/views_draft.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def change_intention(request, name):
470470
class EditInfoForm(forms.Form):
471471
intended_std_level = forms.ModelChoiceField(IntendedStdLevelName.objects.filter(used=True), empty_label="(None)", required=True, label="Intended RFC status")
472472
area = forms.ModelChoiceField(Group.objects.filter(type="area", state="active"), empty_label="(None - individual submission)", required=False, label="Assigned to area")
473-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'), label="Responsible AD", empty_label="(None)", required=True)
473+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active",role__group__type='area').order_by('name'), label="Responsible AD", empty_label="(None)", required=True)
474474
create_in_state = forms.ModelChoiceField(State.objects.filter(used=True, type="draft-iesg", slug__in=("pub-req", "watching")), empty_label=None, required=False)
475475
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)
476476
note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False)
@@ -1039,7 +1039,7 @@ def change_shepherd_email(request, name):
10391039
})
10401040

10411041
class AdForm(forms.Form):
1042-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
1042+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type="area").order_by('name'),
10431043
label="Shepherding AD", empty_label="(None)", required=True)
10441044

10451045
def __init__(self, *args, **kwargs):

ietf/doc/views_status_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def clean(self):
438438
class StartStatusChangeForm(forms.Form):
439439
document_name = forms.CharField(max_length=255, label="Document name", help_text="A descriptive name such as status-change-md2-to-historic is better than status-change-rfc1319", required=True)
440440
title = forms.CharField(max_length=255, label="Title", required=True)
441-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'),
441+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active",role__group__type='area').order_by('name'),
442442
label="Shepherding AD", empty_label="(None)", required=True)
443443
create_in_state = forms.ModelChoiceField(State.objects.filter(type="statchg", slug__in=("needshep", "adrev")), empty_label=None, required=False)
444444
notify = forms.CharField(max_length=255, label="Notice emails", help_text="Separate email addresses with commas", required=False)

ietf/group/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GroupAdmin(admin.ModelAdmin):
2626
list_filter = ["type", "state", "time"]
2727
search_fields = ["acronym", "name"]
2828
ordering = ["name"]
29-
raw_id_fields = ["charter", "parent", "ad"]
29+
raw_id_fields = ["charter", "parent", "_ad"]
3030
inlines = [RoleInline, GroupURLInline]
3131
prepopulated_fields = {"acronym": ("name", )}
3232

@@ -107,7 +107,7 @@ class GroupHistoryAdmin(admin.ModelAdmin):
107107
list_filter = ["type"]
108108
search_fields = ["acronym", "name"]
109109
ordering = ["name"]
110-
raw_id_fields = ["group", "parent", "ad"]
110+
raw_id_fields = ["group", "parent", "_ad"]
111111

112112
admin.site.register(GroupHistory, GroupHistoryAdmin)
113113

ietf/group/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class GroupForm(forms.Form):
3434
techadv = AutocompletedEmailsField(label="Technical Advisors", required=False, only_users=True)
3535
delegates = AutocompletedEmailsField(required=False, only_users=True, max_entries=MAX_GROUP_DELEGATES,
3636
help_text=mark_safe("Chairs can delegate the authority to update the state of group documents - max %s persons at a given time" % MAX_GROUP_DELEGATES))
37-
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active").order_by('name'), label="Shepherding AD", empty_label="(None)", required=False)
37+
ad = forms.ModelChoiceField(Person.objects.filter(role__name="ad", role__group__state="active", role__group__type='area').order_by('name'), label="Shepherding AD", empty_label="(None)", required=False)
3838
parent = forms.ModelChoiceField(Group.objects.filter(state="active").order_by('name'), empty_label="(None)", required=False)
3939
list_email = forms.CharField(max_length=64, required=False)
4040
list_subscribe = forms.CharField(max_length=255, required=False)

0 commit comments

Comments
 (0)