I have this model: class House(models.Model): Huisnumber = models.CharField(max_length=3) Reservation = models.ForeignKey('Data', blank=True) def __unicode__(self): return self.Huisnumber
class Data(models.Model): Name = models.CharField(max_length=30) Arrival = models.DateField() Departure = models.DateField() def __unicode__(self): return '%s %s %s' % (self.Naam, self.Arrival, self.Departure) And this query: range = House.objects.exclude( Reservation__Arrival__range=(Check_arrival, Check_departure) ).exclude( Reservation__Departure__range=(Check_arrival, Check_departure) ) This should get a list of houses which are available. This works fine when only one date (reservation) is entered. When a house has two reservations, only the last entry is evaluated. How should I handle multiple entries? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.