#29843: Create permissions using migration operations rather than using the
post_migrate signal
-------------------------------------+-------------------------------------
     Reporter:  Petter Strandmark    |                    Owner:  Arthur
         Type:                       |  Rio
  Cleanup/optimization               |                   Status:  assigned
    Component:  contrib.auth         |                  Version:  2.1
     Severity:  Normal               |               Resolution:
     Keywords:  contenttypes         |             Triage Stage:  Accepted
  permissions post_migrate           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Another alternative could be to introduce a `post_operation` signal where
 the `sender` would be the operation class, `operation` the `Operation`
 instance and we could include the `from_state` and `to_state` as well.

 The content types app could register a signal receiver for `CreateModel`
 using `post_operation.connect(sender=CreateModel, receiver)` and return
 `[CreateContentType(...)]`. The executor would then execute the collected
 operations. Then auth app could register a
 `post_operation.connect(sender=CreateContentType, receiver)` and return
 `[CreatePermission]` which the executor would execute as well.

 That would allow us get rid of the
 
[https://github.com/django/django/blob/dc5e75d419893bde33b7e439b59bdf271fc1a3f2/django/contrib/contenttypes/management/__init__.py#L45-L84
 nasty plan injection logic] and expose a somewhat reusable interface for
 third party apps all that without enforcing `INSTALLED_APPS` ordering for
 now.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29843#comment:9>
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.7de08eb8d35b3187b86acbbad57ef47b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to