Commit e4ad4be16a1b41f9f43a33f60d776373a9332488
1 parent
7af9c21b
Exists in
master
and in
3 other branches
Initial data for security and themes
Showing
2 changed files
with
70 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,35 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2017-01-10 21:07 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | +def forwards_func(apps, schema_editor): | |
8 | + # We get the model from the versioned app registry; | |
9 | + # if we directly import it, it'll be the wrong version | |
10 | + Security = apps.get_model("security", "Security") | |
11 | + | |
12 | + db_alias = schema_editor.connection.alias | |
13 | + | |
14 | + Security.objects.using(db_alias).bulk_create([ | |
15 | + Security(allow_register = False, maintence = False), | |
16 | + ]) | |
17 | + | |
18 | +def reverse_func(apps, schema_editor): | |
19 | + # forwards_func() creates two Country instances, | |
20 | + # so reverse_func() should delete them. | |
21 | + Security = apps.get_model("security", "Security") | |
22 | + | |
23 | + db_alias = schema_editor.connection.alias | |
24 | + | |
25 | + Security.objects.using(db_alias).filter(allow_register = False, maintence = False).delete() | |
26 | + | |
27 | +class Migration(migrations.Migration): | |
28 | + | |
29 | + dependencies = [ | |
30 | + ('security', '0001_initial'), | |
31 | + ] | |
32 | + | |
33 | + operations = [ | |
34 | + migrations.RunPython(forwards_func, reverse_func), | |
35 | + ] | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2017-01-10 21:09 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations | |
6 | + | |
7 | +def forwards_func(apps, schema_editor): | |
8 | + # We get the model from the versioned app registry; | |
9 | + # if we directly import it, it'll be the wrong version | |
10 | + Themes = apps.get_model("themes", "Themes") | |
11 | + | |
12 | + db_alias = schema_editor.connection.alias | |
13 | + | |
14 | + Themes.objects.using(db_alias).bulk_create([ | |
15 | + Themes(title = 'Projeto Amadeus'), | |
16 | + ]) | |
17 | + | |
18 | +def reverse_func(apps, schema_editor): | |
19 | + # forwards_func() creates two Country instances, | |
20 | + # so reverse_func() should delete them. | |
21 | + Themes = apps.get_model("themes", "Themes") | |
22 | + | |
23 | + db_alias = schema_editor.connection.alias | |
24 | + | |
25 | + Themes.objects.using(db_alias).filter(title = 'Projeto Amadeus').delete() | |
26 | + | |
27 | +class Migration(migrations.Migration): | |
28 | + | |
29 | + dependencies = [ | |
30 | + ('themes', '0001_initial'), | |
31 | + ] | |
32 | + | |
33 | + operations = [ | |
34 | + migrations.RunPython(forwards_func, reverse_func), | |
35 | + ] | ... | ... |