#34288: Using queryset manager methods as default value breaks makemigrations
-------------------------------------+-------------------------------------
Reporter: Mikhail Podgurskiy | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: migrations | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => duplicate
* component: Migrations => Database layer (models, ORM)
Comment:
This was fixed in 46efd03d2674084051f7ce04006e95520649a1ac. However, as
[https://docs.djangoproject.com/en/stable/ref/models/fields/#default
documented]:
> ''"The default can’t be a mutable object (**model instance**, list, set,
etc.), ..."''
> ''"For fields like ForeignKey that map to model instances, defaults
should be the value of the field they reference (pk unless to_field is
set) **instead of model instances**."''
so the default cannot be a model instance.
Duplicate of #33733.
--
Ticket URL: <https://code.djangoproject.com/ticket/34288#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/01070185e2e04dea-031ca70f-457e-414f-b348-cb6aa4c35548-000000%40eu-central-1.amazonses.com.