#23422: Cannot add Permission to Group in data migration
-----------------------------+--------------------------------------
Reporter: Tomas Walch | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by wkleinheerenbrink):
The `emit_post_migrate_signal` is not a complete safe way, for this might
cause other post migrate in apps to be triggered as well that now expect
their tables to exist while they don't yet. For instance the Sites
framework will run `create_default_site` in post migrate, causing this
error.
Other solutions are proposed in:
* https://stackoverflow.com/questions/31735042/adding-django-admin-
permissions-in-a-migration-permission-matching-query-does-n
* https://stackoverflow.com/questions/57958722/django-python-loaddata-
fails-with-django-db-utils-integrityerror
Do note that these solutions required a dependency of migration
`("contenttypes", "0002_remove_content_type_name")` since Django 3.2.5.
--
Ticket URL: <https://code.djangoproject.com/ticket/23422#comment:29>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.f2515404ff868a84e26962213dfaa590%40djangoproject.com.