Re: urls.py and default values...

2012-10-22 Thread Lachlan Musicman
On Mon, Oct 22, 2012 at 5:39 PM, Tomas Ehrlich wrote: > Hello, > you need to make 'year' argument optional: > > def student_reports(request, year=None): > year = year or datetime.date.today().year > ... Perfect - thanks > > Another option could be passing

Re: urls.py and default values...

2012-10-21 Thread Tomas Ehrlich
Hello, you need to make 'year' argument optional: def student_reports(request, year=None): year = year or datetime.date.today().year ... Another option could be passing extra option to you view function:

urls.py and default values...

2012-10-21 Thread Lachlan Musicman
Hola, I have data across multiple years. I want to run reports on a per year basis, so I have in my urls: url(r'^students/reports/(?P\d{4})/$', student_reports, name='student_reports'), etc. What I want to know though, is how to have this in the urls: url(r'^students/reports/$',