This module collects helper functions and classes that "span" multiple levels of MVC. In other words, these functions/classes introduce controlled coupling for convenience's sake.
Function | get |
Use filter() to return a list of objects, or raise an Http404 exception if the list is empty. |
Function | get |
Use get() to return an object, or raise an Http404 exception if the object does not exist. |
Function | redirect |
Return an HttpResponseRedirect to the appropriate URL for the arguments passed. |
Function | render |
Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments. |
Function | resolve |
Return a URL appropriate for the arguments passed. |
Function | _get |
Return a QuerySet or a Manager. Duck typing in action: any class with a `get()` method (for get_object_or_404) or a `filter()` method (for get_list_or_404) might do the job. |
Use filter() to return a list of objects, or raise an Http404 exception if the list is empty. klass may be a Model, Manager, or QuerySet object. All other passed arguments and keyword arguments are used in the filter() query.
Use get() to return an object, or raise an Http404 exception if the object does not exist. klass may be a Model, Manager, or QuerySet object. All other passed arguments and keyword arguments are used in the get() query. Like with QuerySet.get(), MultipleObjectsReturned is raised if more than one object is found.
Return an HttpResponseRedirect to the appropriate URL for the arguments passed. The arguments could be: * A model: the model's `get_absolute_url()` function will be called. * A view name, possibly with arguments: `urls.reverse()` will be used to reverse-resolve the name. * A URL, which will be used as-is for the redirect location. Issues a temporary redirect by default; pass permanent=True to issue a permanent redirect.
Return an HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments.