Created
February 18, 2018 20:53
-
-
Save ceoro9/961ccaaecd1355bf6319f5cb32065143 to your computer and use it in GitHub Desktop.
Example of pre-defined data before migrarion.
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
# -*- coding: utf-8 -*- | |
# Generated by Django 1.11 on 2018-01-22 17:31 | |
"""Load data using py and sqlq | |
... | |
""" | |
from __future__ import unicode_literals | |
from django.db import migrations | |
def load_users(apps, schema_editor): | |
#user = User(..) | |
#user.save() | |
pass | |
def delete_users(apps, schema_editor): | |
#Users = app.get_model(...HELP!!) | |
#Users.object.all().delete() | |
pass | |
def load_users_from_sql(): | |
#return sql_statments | |
pass | |
def delete_users_from_sql(): | |
#return sql_statments | |
pass | |
class Migration(migrations.Migration): | |
dependencies = [ | |
('userauth', '0001_squashed_0002_auto_20180120_1828'), | |
] | |
operations = [ | |
# 1st arg - function to run | |
# 2nd arg - funtcion to run if rollback happens | |
#migrations.RunPython(load_users, delete_users), | |
#migrations.RunSQL(load_user_from_sql(), delete_users_from_sql()) | |
] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment