Hi,

I want to prepopulate a database with the weeknumber (as a separate
filed) from a given date. This is what the models looks like:
class Item(models.model):
    day=models.DateField()
    weekno=models.SmallIntegerField(prepopulate_from(??day??,)

I know that datetime.date.isocalender(day)[1] returns the weeknumber,
but I have no idea how to put this in the model.
What I want to achieve in the end is filtering objects from the db
(obj=item.objects.filter(weekno=current_week))

Your help is appreciated,
Dimitri

-- 
---
You can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to