To access the url parameters in class based views, use self.args
or self.kwargs
so you would access it by doing self.kwargs['year']
More Related Contents:
- is not JSON serializable
- How to set ForeignKey in CreateView?
- How does the order of mixins affect the derived class?
- Updating context data in FormView form_valid method?
- Check if a dictionary contain data true of false, then send a response back
- Iterate over model instance field names and values in template
- Django Passing Custom Form Parameters to Formset
- Using Django time/date widgets in custom form
- When to use get, get_queryset, get_context_data in Django?
- Best way to make Django’s login_required the default
- django template system, calling a function inside a model
- How do I get the object if it exists, or None if it does not exist in Django?
- Find object in list that has attribute equal to some value (that meets any condition)
- django-rest-framework 3.0 create or update in nested serializer
- Django model inheritance: create sub-instance of existing instance (downcast)?
- CSS not loading wrong MIME type Django [duplicate]
- How to filter objects for count annotation in Django?
- Django populate() isn’t reentrant
- How to make Django serve static files with Gunicorn?
- Change Django ModelChoiceField to show users’ full names rather than usernames
- django-debug-toolbar not showing up
- gunicorn.errors.HaltServer: django
- Django Admin Page missing CSS
- Django vs other Python web frameworks?
- How to use csrf_token in Django RESTful API and React?
- Django: Serving Media Behind Custom URL
- How to annotate Count with a condition in a Django queryset
- Run manage.py from AWS EB Linux instance
- How to perform filtering with a Django JSONField?
- Multiple lookup_fields for django rest framework