Hello Django users,

I'm a newby in using django and in need of some help with querying the
database.
Is there a way to combine objects.filter with objects.latest ?

I need that for the following model. In this model there is a
oppurtunity to have multiple lab_id. And also a oppurtunity to have
multiple comments for one lab_id.

class Info(models.Model):

        lab_id = models.IntegerField(maxlength=10)
        dtm_insert = models.DateTimeField('date inserted')

class Panel1Com(models.Model):

        info = models.ForeignKey(Info)
        pla_com1 = models.CharField(maxlength=500)
       pla_com2 = models.CharField(maxlength=500)

what i want is the following i want to create a object from the class
Info where the lab_id is for example 100 and the dtm_insert is the last
one so this object can get the comment back from the last comment
submission in the datebase for lab_id 100

I figured out how i can get the info out with multiple query's but i'm
not really sure if this is correct because i just take the last one in
the array. i just presumed that the last submission would also be the
last one in the array

values = Info.objects.filter(lab_id='100')
value = values(len(values)-1)     pop() doesn't work because it is a
Queryset
comment = value.panel1com_set.values()

thanks in advance for your help,

richard mendes


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