python - Django - decorators and error messages -


this seems simple question can't seem find simple answer. django seems give nifty simple way of limiting access places using permission required or login required decorators can't see django docs how 1 pass error message (maybe using messages framework). if have roll own decorator this, point of django decorators? not show error messages?

i'll assume avoided reading this

http://docs.djangoproject.com/en/1.2/topics/auth/#the-login-required-decorator

login_required() following:

if user isn't logged in, redirect settings.login_url, passing current absolute path in query string. example: /accounts/login/?next=/polls/3/.

if user logged in, execute view normally. view code free assume user logged in.

there no "error messages". error messages rude. , largely useless. they're sign of bad design.

generally, don't need million tiny little explanations. indeed, default login page works fine 80% of use cases. if need clarify situation, can provide own html form. can use ordinary template context add additional information. have messages framework presentation of messages on login page.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -