#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to False. Should use 'is not None' test. -------------------------------------+------------------------------------- Reporter: benreynwar | Owner: Ramiro Type: Bug | Morales <cramm0@…> Component: | Status: closed contrib.contenttypes | Version: master Severity: Normal | Resolution: fixed Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Ramiro Morales <cramm0@…>):
* owner: => Ramiro Morales <cramm0@…> * status: new => closed * resolution: => fixed Comment: In [changeset:"04d9730b127c689b8eda01cbc913efa6e2eb230b"]: {{{ #!CommitTicketReference repository="" revision="04d9730b127c689b8eda01cbc913efa6e2eb230b" Fixed #13085 -- Don't fail on creation of model with GFK to a model with __len__() returning zero. Also, according to the comments on the ticket and its duplicates, added tests execising saving an instance of a model with a GFK to: * An unsaved object -- This actually doesn't generate the same failure but another ORM-level exception. The test verifies it's the case. * An instance of a model with a __nonzero__() method thant returns False for it. This doesn't fail because that code path isn't executed. * An instance of a model with a CharField PK and an empty value for it. This doesn't fail. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:11> 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 post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.