django create dates list from queryset -


I want to make a list of different month / year prices based on the date fields in my DB. So for example in my table I have

id. Date_added | Title

1 | 01/06/2010 | Line

2 | 02/09/2009 | Line

3 | 24/08/2009 | Line

4 | 15/06/2009 | Line

5 | 16/06/2009 |

And this table is from the model article

How do I create a list of:

  ['June 2009 ',' August 2009 ',' September 2009 ',' January 2010 ']  

< P> I believe that you need ['June 2009', 'August 2009', 'September 2009', 'Jan 2010'] for display purposes in your templates. If so, you can do something like

Article.objects.values_list ('date_added', flat = true)

A list of dates

about something like {{"specific" for your requirement, "FI"}} for something like

  {% your_dates_list_that_you_passed_to_the_template%} {% Endfor%}  

[edit]

Please see


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -