In the `SingleObjectMixin` generic view mixin, the `get_context_data` 
method checks if the object is set by using: `if self.object`

I often include this mixin just for the `get_object` functionality and 
error handing it brings. I end up having to set `object = foo` or `object = 
None` to suppress the AttributeError

It seems like the class should initialize `self.object = None` instead of 
relying on a derived class setting it, especially because it doesn't 
guarantee that it will be added to the context - it only adds 'object' (and 
whatever the `context_object_name` param is) to the context if there's an 
object to add.

I'm sure there has been discussion on this before, but I was unable to find 
it here/trac.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/433f75a1-6709-4448-89a0-d1bd7ca7d3b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to