new to django/python developement, can't get this one figured out.

I have a model that has a couple DateFields (issued_date &
completion_date), and I'm trying to return a value with the difference
of the two on each entry that is complete, and then if it isn't
completed yet, show the amount of days since it was issued.
I am using the Admin interface and what I have in the model is
this....

models.py
class RequestTicket(models.Model):
. . .
issued_date = DateField()
completed_date = DateField(blank=True, null=True)

def days_old(self):
complete = RequestTicket.object.filter(completion_date__isnull=False)
for ticket in complete:
return ticket.completion_date - ticket.issued_date
return date.today() - self.issued.date
days_old.short_discription = 'Days Old'

what i get returned is if the first entry was completed within 2 days
(issued=9/14, completed=9/16), all entries after that get 2 days, even
if there is no completion date.
If i use 'self.object.filter(completion_date__isnull=False)', I get a
NONE answer on all entries
If I don't filter for just completed entries I get an error trying to
subtract NoneType field with DateField, i guess that might be from the
NULL setting.
Any help, advice would be great, or if i need to post in another area.

Django version 1.2

thanks
Kenney

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