Jorge Gajon wrote:
>> from proj1.app1.models import User
>> User.objects.get(poll__question__exact='x')
> 
>> from app1.models import User
>> User.objects.get(poll__question__exact='x')
> 
> 
> I don't see any difference except for the 'from' statement.

well, that's it :)

> What 'reverse lookup' are you referring to?


if you look at the model:


> ===================
> class User(models.Model):
>      name = models.CharField(maxlength=200)
> 
> class Poll(models.Model):
>      question = models.CharField(maxlength=200)
>      creator = models.ForeignKey(User)
> ===================

the relation goes "from" Poll "to" User.
so a normal lookup would be:

Poll.objects.get('creator__name__exact' = 'gabor')

but i'm doing a "reverse" one.

and the strange thing (the reason why i'm reporting this) is that just 
based on the difference in the "from" statement, i get different results 
(works in first case, fails in second case).

btw. the "normal" lookup works fine in both cases.

best to try out in "manage.py shell".

gabor

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to