month_ids is a list of months like this... [('Apr07', 'April 2007'), ('Mar07', 'March 2007'), ('Feb07', 'February 2007')]
which can be used in a select box like this..
month = forms.ChoiceField(choices=(months))
1 2 3 4 5 6 7 8 9 10 11 | from mx.DateTime import *
from datetime import datetime
date = now()
month_ids = []
while not (date.month == 4 and date.year == 2004):
month_ids.append((date.strftime('%b%y'),date.strftime('%B %Y')))
date = date + RelativeDateTime(months=-1)
print month_ids
#date.days_in_month
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 months ago
Comments
Please login first before commenting.