#32851: GenericRelation inherited from Abstract model in different app fails to
generate migration
------------------------------------+--------------------------------------
Reporter: Foucauld Degeorges | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Changes (by Carlton Gibson):
* status: new => closed
* resolution: => invalid
Comment:
[https://docs.djangoproject.com/en/3.2/ref/models/fields/#foreignkey From
the ForeignKey docs]:
> To refer to models defined in another application, you can explicitly
specify a model with the full application label.
So, despite you saying you tried this, this works:
{{{
some_relation = GenericRelation(
"app_a.Bar",
content_type_field="foo_type",
object_id_field="foo_id"
)
}}}
As does making `Bar` a non-lazy reference:
{{{
some_relation = GenericRelation(
Bar,
content_type_field="foo_type",
object_id_field="foo_id"
)
}}}
Both of these approaches correctly generate the correct migrations. Please
see TicketClosingReasons/UseSupportChannels if you require further
assistance.
--
Ticket URL: <https://code.djangoproject.com/ticket/32851#comment:1>
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/065.5dcbe49cbd78295bedaf276bca917f17%40djangoproject.com.