#23422: Cannot add Permission to Group in data migration
----------------------------+--------------------------------------
Reporter: tjwalch | 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
----------------------------+--------------------------------------
Changes (by alanjds):
* needs_docs: 0 => 1
Comment:
Replying to [comment:12 guettli]:
> I am not happy with this issue being "wontfix".
>
> A helper method `create_missing_content_types_and_permissions()` would
be nice.
Found! This helper method exists already:
`django.core.management.sql.emit_post_migrate_signal`
{{{
from django.core.management.sql import emit_post_migrate_signal
def create_group(apps, schema_editor):
db_alias = schema_editor.connection.alias
try:
emit_post_migrate_signal(2, False, 'default', db_alias)
except TypeError: # Django < 1.8
emit_post_migrate_signal([], 2, False, 'default', db_alias)
Group = apps.get_model('auth', 'Group')
Permission = apps.get_model('auth', 'Permission')
(...)
}}}
I suggest this behavior and "how to deal with" to be documented on the
Permissions page.
Is this acceptable instead of a ''wontfix'' ?
--
Ticket URL: <https://code.djangoproject.com/ticket/23422#comment:20>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.4505e8d58a5181c3440846350783e7e5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.