#18599: GenericForeignKey field can't be set on init of moel
--------------------------------------+--------------------
Reporter: dpantele | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
If we are trying to set GenericForeignKey to non-saved object during model
initialization, it is not set.
For example:
{{{
class A(models.model):
pass
class B(models.model):
object_id = models.PositiveIntegerField()
content_type = models.ForeignKey(ContentType)
obj = generic.GenericForeignKey()
...
a = A()
b = B(obj=a)
b.obj # None
b.obj.save() # 'NoneType' object has no attribute 'save'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/18599>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.