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 extra option to you view funct
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:
https://docs.djangoproject.com/en/1.4/topics/http/urls/#passing-extra-options-to-view
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/$', student_reports
3 matches
Mail list logo