Thursday, March 15, 2012

Newbie Django queryset question

Hey guys, sorry if this is a newbie question, but I'm new at django and I'm having a real hard time trying to figure out how to solve this. So I have this model.
class Run(models.Model):
    speccpus = models.ForeignKey('Speccpu')
    hosts = models.ForeignKey('Host')

    Task = models.IntegerField()
    Path = models.CharField(max_length = 300)
    Date_Time = models.DateTimeField()

class Host(models.Model):
    Name = models.CharField(max_length = 100)
    ip_addr = models.IPAddressField()
    admin_ip_addr = models.IPAddressField()
    Location = models.CharField(max_length = 100)

class Speccpu(models.Model):
    Version = models.CharField(max_length = 50)
    Base_score = models.IntegerField()
    Peak_score = models.IntegerField()

So what i need to do is search a for an input in any of this fields, so they can return more than one row of a table, since i need to display on the screen a table containing the Run - Task, Path, Date_Time fields, also the Host Name field, and the Speccpu Base and peak score. I was thinking about doing something like an inner join of this three models, and then filtering. But i can't manage to do it. Does anyone have any ideia of how i can do it using the queryset API?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/rEEVGXSHL4AJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate