#35694: FK inconsistency beween `get_or_create` and any other orm function -------------------------------------+------------------------------------- Reporter: KIC | Owner: (none) Type: | Status: closed Cleanup/optimization | Component: Database layer | Version: 5.1 (models, ORM) | 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 Sarah Boyce):
* resolution: => invalid * status: new => closed Comment: This is consistent with create - `models.B.objects.create(dict(bar="does not exist"), bar="baz", a=a.pk)` would also raise a `ValueError` You can use the `_id` suffix `models.B.objects.get_or_create(dict(bar="does not exist"), bar="baz", a_id=a.pk)` (same for create) -- Ticket URL: <https://code.djangoproject.com/ticket/35694#comment:2> 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/0107019173f8ac47-8bad3e82-e3de-4904-b1d6-dd148443f33f-000000%40eu-central-1.amazonses.com.