You can do do something like this:
date = date.today()
while date.day != 20:
    date += timedelta(1)

~Jakob

On 18 Apr., 21:57, Alfonso <[email protected]> wrote:
> Hi,
>
> I'd like to set the default date of a datefield to be 'the 20th of the
> current month', if past that date the date should be set to the 20th
> of the following month.
>
> So if a record is created on 1st April the datefield would be 20th
> April 2009, if record is created on 21st April then the datefield
> would be 20th May 2009.
>
> Figuring a custom save method would do fine for this but not sure on
> the syntax re. datetime and relativedelta etc.
>
> Anyone got any ideas or code lying around that might help?
>
> Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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