#20442: Stale ContentType objects cause a NoneType error in get_for_id
-------------------------------------+-------------------------------------
     Reporter:  vdboor               |                    Owner:  vdboor
         Type:  Bug                  |                   Status:  assigned
    Component:                       |                  Version:  1.4
  contrib.contenttypes               |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:  dceu13               |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by vdboor):

 * has_patch:  0 => 1


Comment:

 When evaluating the solutions with my local projects, it turns out that
 option nr1 (return the content type) is the best solution.
 The `get_for_id()` returns the `ContentType` object as promised, and like
 any other operation (e.g. `ContentType.objects.all()`), the caller would
 have to check for `ct.model_class() is None`.

 Pull request: https://github.com/django/django/pull/1130

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20442#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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to