ReverseSingleRelatedObjectDescriptor and limit_choices_to

73 views
Skip to first unread message

Michael Radziej

unread,
Apr 6, 2006, 12:38:24 PM4/6/06
to django-d...@googlegroups.com
Hi,

About magic-removal--I have defined a ForeignKey? with limit_choices_to
for, say, "somefield". Now, when I do:

someobject.somefield

the resulting query to the related object does not use this limitation.
Shouldn't it do this? Hmm, this is a "how is it supposed to work"
question, so I'd like to see what you think.

I've posted a ticket with a patch (it's very small)

http://code.djangoproject.com/ticket/1592

Michael

Luke Plant

unread,
Apr 6, 2006, 1:54:32 PM4/6/06
to django-d...@googlegroups.com
On Thursday 06 April 2006 17:38, Michael Radziej wrote:
> Hi,
>
> About magic-removal--I have defined a ForeignKey? with
> limit_choices_to for, say, "somefield". Now, when I do:
>
> someobject.somefield
>
> the resulting query to the related object does not use this
> limitation. Shouldn't it do this? Hmm, this is a "how is it supposed
> to work" question, so I'd like to see what you think.

From the docs:
limit_choices_to
A dictionary of lookup arguments and values (see the Database API
reference) that limit the available admin choices for this object.

i.e. it only limits what you seen in the admin.

Luke

--
"Despair: It's always darkest just before it goes pitch black."
(despair.com)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

Reply all
Reply to author
Forward
0 new messages