If your urlconf looks something like this:
url(r'^(?P<slug>[a-zA-Z0-9-]+)/$', MyView.as_view(), name="my_named_view")
then the slug will be available inside your view functions (such as ‘get_queryset’) like this:
self.kwargs['slug']
More Related Contents:
- django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. plz help me out plz
- Django optional url parameters
- Django reverse lookup of foreign keys
- How to receive json data using HTTP POST request in Django 1.6?
- How to set up custom middleware in Django
- Django: CSRF token missing or incorrect
- is there a way to loop over two lists simultaneously in django?
- ValueError: Missing staticfiles manifest entry for ‘favicon.ico’
- Using request.user with Django ModelForm
- Class has no objects member
- How to change the file name of an uploaded file in Django?
- matching query does not exist Error in Django
- How to expire Django session in 5minutes?
- The view didn’t return an HttpResponse object. It returned None instead
- Django – form.save() is not creating ModelForm
- Class Based Views VS Function Based Views
- How does the order of mixins affect the derived class?
- Django 1.11 TypeError context must be a dict rather than Context
- Unable to import path from django.urls
- Override a form in Django admin
- How do I call a Django function on button click?
- Django Passing data between views
- QuerySet, Object has no attribute id – Django
- Django DoesNotExist
- Can I make STATICFILES_DIR same as STATIC_ROOT in Django 1.3?
- Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given
- How to redirect from a view to another view In Django
- Django — Conditional Login Redirect
- How to manage local vs production settings in Django?
- Making moves w/ websockets and python / django ( / twisted? )