How to get keword argument from url in django class based views? -


Is there a way to get keyword arguments declared in url.py within class based consideration methods?

For example: I want to override the get_initial (self) to set one of the values ​​from the url. I really want to do it __ init __ to override?

You can do this:

  arg_value = self .kwargs.get (ARGUMENT_NAME, none)   

How it is done SingleObjectMixin , which provides the get_object functionality used in DetailView Does.



Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -