Hi,

A newbie question here. I'm trying to retrieve all users from the
system who are basically fully active. ie. not held or paused, and
lastly only select people who have a duration that is greater than the
number of 'days' that their contract has been running.

The problem seems to be that i'm storing the duration and days in the
same table. The contracts are not fixed length, they can be extended
so i decided to store them in the UserContract model.

This works except it misses users who have reached the end of their
contract.

User.objects.filter
(usercontract__held=False,usercontract__pausedate__lte=datetime.now())

here is my UserContract model:

class UserContract(models.Model):
    user = models.ForeignKey(User)
    pausedate = models.DateField(null=True,blank=True)
    held = models.BooleanField(default=False)
    days = models.IntegerField(default=0)
    duration = models.IntegerField()
    contract = models.ForeignKey(Contract)

How can i do this comparison?

p.s.I'm running django 1.0.2

Thanks,

nibudh.

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