Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Document how to create Widgy Owners in migrations #276

Open
rockymeza opened this issue Nov 20, 2014 · 0 comments
Open

Document how to create Widgy Owners in migrations #276

rockymeza opened this issue Nov 20, 2014 · 0 comments

Comments

@rockymeza
Copy link
Contributor

We need to document how to create Widgy Owners in a migration.

Here's what I just did:

from django.contrib.contenttypes.models import ContentType

from ..models import MyRootBucket

class Migration(DataMigration):
    def forwards(self, orm):
        "Write your forwards methods here."
        ct = ContentType.objects.get_for_model(MyRootBucket)
        orm['widgets.MyOwner'].objects.create(content=ct)

    def backwards(self, orm):
        "Write your backwards methods here."
        orm['widgets.MyOwner'].objects.all().delete()

But I don't know if it's correct.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant