This repository has been archived by the owner on Jun 6, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#52] Page model should use the standard statemachine
- Loading branch information
1 parent
001edeb
commit a0da355
Showing
8 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.4 on 2016-04-20 21:00 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ostinato_pages', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='page', | ||
options={'permissions': (('public_view_page', '[Public] Can View Page'), ('public_edit_page', '[Public] Can Edit Page'), ('public_delete_page', '[Public] Can Delete Page'), ('can_make_private_page', 'Can Make_private Page'), ('private_view_page', '[Private] Can View Page'), ('private_edit_page', '[Private] Can Edit Page'), ('private_delete_page', '[Private] Can Delete Page'), ('can_make_public_page', 'Can Make_public Page')), 'verbose_name': 'Page', 'verbose_name_plural': 'Pages'}, | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='state', | ||
field=models.CharField(choices=[(b'public', b'Public'), (b'private', b'Private')], default=5, max_length=20, verbose_name='State'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.4 on 2016-04-20 21:11 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
def update_states(apps, schema_editor): | ||
""" | ||
Update from old integer based states to the now more verbose | ||
states | ||
""" | ||
Page = apps.get_model('ostinato_pages', 'Page') | ||
for page in Page.objects.all(): | ||
if page.state == '1': | ||
page.state == 'private' | ||
elif page.state == '5': | ||
page.state == 'public' | ||
page.save() | ||
|
||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ostinato_pages', '0002_auto_20160420_2100'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_states), | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters