On Tue, Mar 3, 2009 at 11:13 AM, [CPR]-AL.exe <cpr.al....@gmail.com> wrote:

>
> for example, i have this models:
> (like here: http://www.djangoproject.com/documentation/models/many_to_one/
> )
>
> ----------------------------------------------------------------------------------------
> from django.db import models
>
> class Reporter(models.Model):
>    first_name = models.CharField(max_length=30)
>    last_name = models.CharField(max_length=30)
>    email = models.EmailField()
>
>    def __unicode__(self):
>        return u"%s %s" % (self.first_name, self.last_name)
>
> class Article(models.Model):
>    headline = models.CharField(max_length=100)
>    pub_date = models.DateField()
>    reporter = models.ForeignKey(Reporter)
>
>    def __unicode__(self):
>        return self.headline
>
>    class Meta:
>        ordering = ('headline',)
>
> ----------------------------------------------------------------------------------------
>
> I have some amount of articles and i have to reporters, with first
> names "John" and "Paul".
>
> I want to get all Articles, created by John and Paul (not only by John
> and only by Paul). Who this could be done and who could this be done
> with a Q-object (in one query)?
>
> >
>
I suggest you start by taking a look at this section of the docs:
http://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to