Skip to content

Commit cd3e4fe

Browse files
committed
Add unique constraint on acronyms, fixup SDOs to have auto-generated
slugified acronyms - Legacy-Id: 3745
1 parent 2c81e8d commit cd3e4fe

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

redesign/group/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
class GroupInfo(models.Model):
1010
time = models.DateTimeField(default=datetime.datetime.now)
1111
name = models.CharField(max_length=80)
12-
acronym = models.CharField(max_length=16, blank=True, db_index=True)
1312
state = models.ForeignKey(GroupStateName, null=True)
1413
type = models.ForeignKey(GroupTypeName, null=True)
1514
parent = models.ForeignKey('Group', blank=True, null=True)
1615
iesg_state = models.ForeignKey(IesgGroupStateName, verbose_name="IESG state", blank=True, null=True)
17-
ad = models.ForeignKey(Person, blank=True, null=True)
16+
ad = models.ForeignKey(Person, verbose_name="AD", blank=True, null=True)
1817
list_email = models.CharField(max_length=64, blank=True)
1918
list_subscribe = models.CharField(max_length=255, blank=True)
2019
list_archive = models.CharField(max_length=255, blank=True)
@@ -36,7 +35,7 @@ def active_wgs(self):
3635
class Group(GroupInfo):
3736
objects = GroupManager()
3837

39-
# we keep charter separate
38+
acronym = models.CharField(max_length=40, unique=True, db_index=True)
4039
charter = models.OneToOneField('doc.Document', related_name='chartered_group', blank=True, null=True)
4140

4241
def latest_event(self, *args, **filter_args):
@@ -50,6 +49,7 @@ def latest_event(self, *args, **filter_args):
5049
# to select group history from this table.
5150
class GroupHistory(GroupInfo):
5251
group = models.ForeignKey(Group, related_name='history_set')
52+
acronym = models.CharField(max_length=40)
5353
charter = models.ForeignKey('doc.Document', related_name='chartered_group_history_set', blank=True, null=True)
5454

5555
class Meta:

redesign/importing/import-groups.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from django.core import management
1212
management.setup_environ(settings)
1313

14+
from django.template.defaultfilters import slugify
1415

1516
from redesign.group.models import *
1617
from redesign.name.models import *
@@ -168,6 +169,7 @@
168169
group = Group(name=o.sdo_name, type=type_names["sdo"])
169170

170171
group.state_id = "active"
172+
group.acronym = slugify(group.name)
171173
group.save()
172174

173175
def import_date_event(group, name, type_name):

0 commit comments

Comments
 (0)