This commit is contained in:
Norman Jäckel 2013-06-02 23:12:00 +02:00
parent 63840df7b5
commit a575a7a8c6
2 changed files with 72 additions and 69 deletions

View File

@ -136,7 +136,8 @@ def create_builtin_workflows(sender, **kwargs):
""" """
Creates a simple and a complex workflow. Creates a simple and a complex workflow.
""" """
workflow_1 = Workflow.objects.create(name=ugettext_noop('Simple Workflow')) workflow_1, created = Workflow.objects.get_or_create(name=ugettext_noop('Simple Workflow'))
if created:
state_1_1 = State.objects.create(name=ugettext_noop('submitted'), state_1_1 = State.objects.create(name=ugettext_noop('submitted'),
workflow=workflow_1, workflow=workflow_1,
allow_create_poll=True, allow_create_poll=True,
@ -155,7 +156,8 @@ def create_builtin_workflows(sender, **kwargs):
workflow_1.first_state = state_1_1 workflow_1.first_state = state_1_1
workflow_1.save() workflow_1.save()
workflow_2 = Workflow.objects.create(name=ugettext_noop('Complex Workflow')) workflow_2, created = Workflow.objects.get_or_create(name=ugettext_noop('Complex Workflow'))
if created:
state_2_1 = State.objects.create(name=ugettext_noop('published'), state_2_1 = State.objects.create(name=ugettext_noop('published'),
workflow=workflow_2, workflow=workflow_2,
allow_support=True, allow_support=True,

View File

@ -68,8 +68,9 @@ def create_builtin_groups(sender, **kwargs):
Creates the builtin groups: Anonymous, Registered, Delegates and Staff. Creates the builtin groups: Anonymous, Registered, Delegates and Staff.
""" """
# Check whether the group pks 1 to 4 are free # Check whether the group pks 1 to 4 are free
for pk in range(1, 5): if Group.objects.filter(pk__in=range(1, 5)).exists():
assert not Group.objects.filter(pk=pk).exists(), 'There should not be any group with pk 1, 2, 3 or 4.' # Do completely nothing if there are already some of our groups in the database.
return
# Anonymous and Registered # Anonymous and Registered
ct_projector = ContentType.objects.get(app_label='projector', model='projectorslide') ct_projector = ContentType.objects.get(app_label='projector', model='projectorslide')