On 26 Dec 2011, at 19:01, Andre Terra wrote:

> I propose we add a "lookup" attribute which defaults to "__exact" (for 
> backwards-compatibility as well as avoiding surprises) and is combined with 
> slug_field in the filter call so that users can customize the filter kwarg in 
> an elegant fashion. Before reading the source code carefully, I had written 
> my own mixin that just used string formatting (i.e. "%s_%s" % (slug_field, 
> lookup)") to handle this, and I liked how it looked. I am, however, more than 
> willing to take a different route should anyone suggest it.
> 
> Another solution would be to keep the current code as is, and just add a note 
> in the docs regarding the flexibility of slug_field. Given that the attribute 
> name does say *field*, I'm not too fond of this approach.
> 
> 
> Again, I'm willing to hear any feedback on this matter, as well as writing 
> patches and tests, as I expect them to be quite simple and therefore within 
> my abilities.
> 
> 
> 
> Cheers,
> 
> André Terra (airstrike)

Hi André

I'm trying to understand what your use case would be. SingleObjectMixin is 
designed to only ever give you one object back (though I'm surprised it doesn't 
handle the MultipleObjectsReturned exception), so out of all the lookup choices 
we have, only an exact match on a unique field makes sense. Am I missing 
something here?

Regards,
Andrew Ingram

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en.

Reply via email to