in a database table: - Added a GroupFeatures model to the group models, and removed the old features.py - Added a agenda type for future use in showing different group types on different agendas. - Renamed the group feature has_materials to has_nonsession_materials. - Added API resources and admin support for the new tables. - Added a Directorate (with reviews) group type as complement to Directorate, to distinguish between directorates with and without reviews. - Adjusted tests as needed. - Updated the fixtures, and fixed the generate_fixtures script to include the new AgendaTypeName objects. There still exists about 70 instances of code comparing the group type with a list of types; most of these should probably be replaced with new features, instead, to make it possible to add new group types through the database table, rather than having to edit the code. That was the purpose of this refactoring from the start, but the presence of this large number of comparisons of group type against lists of types defeats the goal until we add appropriate features and replace the group type list comparisons. - Legacy-Id: 15316
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
import debug # pyflakes:ignore
|
|
import factory
|
|
|
|
from ietf.group.models import Group, Role, GroupEvent
|
|
from ietf.review.factories import ReviewTeamSettingsFactory
|
|
|
|
class GroupFactory(factory.DjangoModelFactory):
|
|
class Meta:
|
|
model = Group
|
|
django_get_or_create = ('acronym',)
|
|
|
|
name = factory.Faker('sentence',nb_words=6)
|
|
acronym = factory.Sequence(lambda n: 'acronym%d' %n)
|
|
state_id = 'active'
|
|
type_id = 'wg'
|
|
list_email = factory.LazyAttribute(lambda a: '%s@ietf.org'% a.acronym)
|
|
|
|
class ReviewTeamFactory(factory.DjangoModelFactory):
|
|
class Meta:
|
|
model = Group
|
|
|
|
type_id = 'review'
|
|
name = factory.Faker('sentence',nb_words=6)
|
|
acronym = factory.Sequence(lambda n: 'acronym%d' %n)
|
|
state_id = 'active'
|
|
|
|
@factory.post_generation
|
|
def settings(obj, create, extracted, **kwargs):
|
|
ReviewTeamSettingsFactory.create(group=obj,**kwargs)
|
|
|
|
class RoleFactory(factory.DjangoModelFactory):
|
|
class Meta:
|
|
model = Role
|
|
|
|
group = factory.SubFactory(GroupFactory)
|
|
person = factory.SubFactory('ietf.person.factories.PersonFactory')
|
|
email = factory.LazyAttribute(lambda obj: obj.person.email())
|
|
|
|
class GroupEventFactory(factory.DjangoModelFactory):
|
|
class Meta:
|
|
model = GroupEvent
|
|
|
|
group = factory.SubFactory(GroupFactory)
|
|
by = factory.SubFactory('ietf.person.factories.PersonFactory')
|
|
type = 'comment'
|
|
desc = factory.Faker('paragraph')
|