Add predicate decorator to not match specific view (#20479) #1199

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@rach

rach commented May 22, 2013

Predicates is concept brought back from Pyramid, Pylon.
It has the goal of allowing a better organization of your function based view and get rid of redundant code as if request.method == 'POST

ticket : https://code.djangoproject.com/ticket/20479#ticket

@areski

View changes

docs/topics/http/decorators.txt
+
+The decorators in :mod:`django.views.decorators.predicate` can be used to restrict
+the match of views based on the list of function check list.
+These decorators will attach a list of functions to be checked before returning a match for the url. If the predicates fail then the process continue the url resolving process.

This comment has been minimized.

@areski

areski May 22, 2013

Contributor

add CR

@areski

areski May 22, 2013

Contributor

add CR

@areski

View changes

docs/topics/http/decorators.txt
+================================
+
+The decorators in :mod:`django.views.decorators.predicate` can be used to restrict
+the match of views based on the list of function check list.

This comment has been minimized.

@areski

areski May 22, 2013

Contributor

The decorators in :mod:django.views.decorators.predicate can be used to restrict the view selection based on a function result.

@areski

areski May 22, 2013

Contributor

The decorators in :mod:django.views.decorators.predicate can be used to restrict the view selection based on a function result.

@@ -51,6 +51,40 @@ a :class:`django.http.HttpResponseNotAllowed` if the conditions are not met.
such as link checkers, rely on HEAD requests, you might prefer
using ``require_safe`` instead of ``require_GET``.
+

This comment has been minimized.

@areski

areski May 22, 2013

Contributor

What about a title : Predicate url processing

@areski

areski May 22, 2013

Contributor

What about a title : Predicate url processing

This comment has been minimized.

@rach

rach May 22, 2013

Updated in the new commit

@rach

rach May 22, 2013

Updated in the new commit

Add predicate decorator to not match specific view
Predicates is concept brought back from Pyramid, Pylon.
It has the goal of allowing a better organizatio of your
function based view and get rid of redundant code as
`if request.method == 'POST`

Improve the doc about predicates

Change title about predicate in the docs

Fix predicate explanation in docs
@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Jul 19, 2013

Member

I'm going to close this for now based on the comments from the ticket.

Member

timgraham commented Jul 19, 2013

I'm going to close this for now based on the comments from the ticket.

@timgraham timgraham closed this Jul 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment