coffee.contrib.decorators
coffee.contrib.decorators#
- coffee.contrib.decorators.get_only(func)[source]#
Decorator function to only allow GET requests, anything else will return a 405.
- Returns:
JsonResponseorview_function().- Usage:
@get_only def foo(request): return 'bar'
- coffee.contrib.decorators.post_only(func)[source]#
Decorator function to only allow POST requests, anything else will return a 405.
- Returns:
JsonResponseorview_function().- Usage:
@post_only def foo(request): return 'bar'
- coffee.contrib.decorators.render_view(func)[source]#
Decorator function to consistently package
HttpRequestparameters into named kwargs.- Function sets the following kwargs:
app_name: name of the application, case sensitive.model_name: name of the application, case sensitive.pk: pk of the model classjson:json=true, return pure rendered html or return html in a jsonpage_size: default size 15 (applies toModelFormList)page: default page = 1 (applies toModelFormList)pagination: render pagination in form or not
- Returns:
JsonResponseorview_function().- Usage:
@get_only def foo(request): return 'bar'