thanks.

that probably also means, that I´m not able to get related postings  
from a list of comments in the template.
so, I have to construct a list of comments with postings and user- 
details. seems a bit heavy ...

having my scenario in mind, it´s probably better to write my own  
comment-model.

patrick

Am 09.10.2006 um 15:36 schrieb Aidas Bendoraitis:

>
> Hello patrickk!
>
> Generic relations are limitting in the way, that it's impossible to
> select from all tables from the relationship at once. What you can do
> is to get the 10 comments in Python level. That is to get a list of
> all Postings of some author, then for each of the Postings, to get its
> comments into one comment list, then to sort that comment list in
> Python level according the creation date, and lastly return only the
> first ten comments to the response.
>
> Good luck!
> Aidas Bendoraitis [aka Archatas]
>
> On 10/9/06, patrickk <[EMAIL PROTECTED]> wrote:
>>
>> some more details:
>>
>> my posting-model:
>>
>> class Posting(models.Model):
>>      title = models.CharField('Titel', maxlength=200)
>>      ...
>>      user = models.ForeignKey(User)
>>      ...
>>
>> so, every posting is connected to a user.
>> question is, how do I get the latest comments for postings by that  
>> user?
>>
>> usually, I´d write something like:
>> Comment.objects.filter(object__user=userid)
>>
>> but since comment doesn´t know what object_id is referring to, that
>> doesn´t work.
>>
>> thanks,
>> patrick
>>
>>
>> Am 06.10.2006 um 17:47 schrieb patrickk:
>>
>>>
>>> I´m currently trying to use the comment framework and I´m trying to
>>> retrieve the last 10 comments given for postings by a specific user.
>>>
>>> the lookup I´d like to have is:
>>>
>>> select * from comments
>>> join posting on comments.object_id = postings.id
>>> join user on posting.user_id = user.id
>>>
>>> more detailed:
>>>
>>> I´m on the weblog-site of a user, so I have the users id (which is
>>> different from the logged-in user).
>>> this user has postings and there are comments to this postings.
>>> now, I´d like to have a list with the last 10 comments on this users
>>> postings.
>>>
>>> I hope this is not too confusing.
>>>
>>> thanks,
>>> patrick
>>>>
>>
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to