I'm trying to obtain a list of persons whose birthday is in the next 15 days. I have this model:
class Cliente(models.Model):
nombre = models.CharField(max_length=100)
fecha_nacimiento = models.DateField(default=datetime.date.today,blank=True,null=True)
telefono_numero = models.CharField(max_length=10, null=True)
direccion = models.CharField(max_length=100, null=True)
otro_contacto = models.CharField(max_length=150, null=True)
def __unicode__(self):
return u'%s' % self.nombre
and my field "fecha_nacimiento" (date of birth) is a models.DateField. When I can obtain people whose birthday is in the current month by using that:
mes = date.today().month
cumplen_mes = Cliente.objects.filter(fecha_nacimiento__month=mes)
and I have a queryset with whom birthday in an specific month, but I want to see only those birthdays in the next 15 days. I tried with filters but I don't know how concatenate filters i.e.:
I can do that Cliente.objects.filter(fecha_nacimiento__day = a_day)
I read about gte & lte but can't combine with this filter over fecha_nacimiento field.