#33385: Unexpected behavior regarding custom permissions creation
-----------------------------------------+------------------------
               Reporter:  Ramez Issac    |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Migrations     |        Version:  2.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Hello wonderful Django community ,

 Brief of the issue:
 Custom permissions are created at the very end of a manage.py migrate.
 Not after its addition in the same migration
 `migrations.AlterModelOptions`, Nor after the its specific migration is
 applied .

 Outcome:
 One can not assign custom permissions in a data migration.

 Use Case:
 I added some custom permissions on a model and i want to assign some of
 those new permissions to users based on some criteria.
 I made this assignment in the same migration. It failed because the new
 permissions were not found.
 Ok, i can understand that...
 So, i made another data migration and put the assignment there,  also this
 fails because permission is not found.

 What i have to do then is
 1. python manage.py migrate my_app migration_with_meta_change_adding_perms
 Then
 2. python manage.py migrate my_app
 migration_with_the_run_python_assign_permissions

 And i have to execute it explicitly like shown above or else it will
 fail... i don't think this is the expected behavior.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33385>
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/053.6dd923f04ae4b0b6a0da2a2a752d23fc%40djangoproject.com.

Reply via email to