Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def kill_default(apps, schema_editor):
- User = apps.get_model('auth', 'User')
- Post = apps.get_model('articles', 'Post')
- Comment = apps.get_model('articles', 'Comment')
- user = User.objects.create_user(username='someus',
- email='someus@k.kf',
- password='qwertyuio',
- )
- user.save()
- for post in Post.objects.all():
- post.author = user
- post.save()
- post = Post.objects.create(title='aboutblah',
- full_text='blahisblahofblahunderblah',
- author=user)
- post.save()
- comment = Comment.objects.create(text='niceblahstination',
- post=post,
- author=user)
- comment.save()
- class Migration(migrations.Migration):
- dependencies = [
- ('articles', '0006_auto_20171107_1626'),
- ]
- operations = [
- migrations.RunPython(kill_default),
- ]
Add Comment
Please, Sign In to add comment