#34165: migrate management command does not respect database parameter when adding Permissions. ------------------------------+------------------------------------ Reporter: Vasanth | Owner: nobody Type: Bug | Status: new Component: contrib.auth | Version: 4.1 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------------+------------------------------------
Comment (by Mariusz Felisiak): > Apart from that, if we don't want to set directly the internal attribute `_state.db`, I guess we would need a proper way to pass the `db`/`using` to the model instantiation. `_state` is [https://docs.djangoproject.com/en/4.1/ref/models/instances/#state documented] so using it is not so bad. > What would be the most ''Django-y'' way? > - Passing it through the model constructor => this has quite a large impact, as a keyword argument would possibly shadow existing field names: `Permission(..., db=using)`. Quite risky in terms of backward compatibility I guess. > - Adding a method to `Model`? Something like: `Permission(...).using(db)`, which could perhaps then be re-used in other places also. > > What do you think ? :) Or am I missing other solutions? Django doesn't support cross-db relationships and users were always responsible for assigning related objects from the same db. I don't think that we should add more logic to do this. The `Permission`-`content_type` issue is really an edge case in managing relations, as for me we don't need a generic solution for it. -- Ticket URL: <https://code.djangoproject.com/ticket/34165#comment:12> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/010701852f026742-529aa951-92a0-4272-96f6-de678682e572-000000%40eu-central-1.amazonses.com.