#32695: Create Permissions with create() instead of bulk_create() to send signal
------------------------------------------------+------------------------
               Reporter:  laurent-brisbois      |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  contrib.auth          |        Version:  3.2
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  1
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 Hello there !

 It seems Django is creating new Permission records in a post_migrate
 signal handler, especially in the method create_permissions which is
 called
 
[https://github.com/django/django/blob/263ee4434fe814ee15ef231549273f16d7fad520/django/contrib/auth/apps.py#L20
 here].

 It would be great if it was possible to act on Permission creation. I mean
 by using create() instead of bulk_create(), pre_save() and post_save()
 signals would be sent and therefore it would be possible to, for instance,
 assign a Permission once it is created  with the post_save() signal.

 I guess the only think to do would be to change
 
[https://github.com/django/django/blob/263ee4434fe814ee15ef231549273f16d7fad520/django/contrib/auth/management/__init__.py#L83
 this line].

 I could even do it if you say it will be accepted.

 Otherwise how could it be possible to achieve it ? I mean assign a
 Permission once it is created..?

 Kind regards,

 A Django Lover.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32695>
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/059.62ac3773a86c54cf6297432a0dfa482a%40djangoproject.com.

Reply via email to