Create DJ profile manually as signals won't work in migration.
This commit is contained in:
parent
0607d26685
commit
f4ee7c5bd1
1 changed files with 23 additions and 0 deletions
23
savepointradio/profiles/migrations/0002_create_dj_profile.py
Normal file
23
savepointradio/profiles/migrations/0002_create_dj_profile.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 2.0 on 2018-01-19 17:04
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_dj_profile(apps, schema_editor):
|
||||
User = apps.get_model('core', 'RadioUser')
|
||||
Profile = apps.get_model('profiles', 'RadioProfile')
|
||||
db_alias = schema_editor.connection.alias
|
||||
|
||||
dj = User.objects.get(is_dj=True)
|
||||
profile = Profile.objects.create(user=dj)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('profiles', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_dj_profile),
|
||||
]
|
Loading…
Reference in a new issue