daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Oct 17th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Django/django_bookmarks/urls.py    
  2. urlpatterns = patterns('',
  3.     (r'^$', main_page),
  4.     (r'^user/(w+)/$', user_page),
  5.     (r'^login/$', 'django.contrib.auth.views.login'),
  6. )    
  7.  
  8. # login.html
  9. <html>
  10.   <head>
  11.     <title>Django Bookmarks - User Login</title>
  12.   </head>
  13.  
  14.   <body>
  15.     <h1>User Login</h1>
  16.     {% if form.errors %}
  17.     <p>Your username and password didn't match.
  18.       Please try again.</p>
  19.     {% endif %}
  20.     <form method="post" action=".">
  21.       {% csrf_token %}
  22.       <p><label for="id_username">Username:</label>
  23.     {{ form.username }}</p>
  24.       <p><label for="id_password">Password:</label>
  25.     {{ form.password }}</p>
  26.       <input type="hidden" name="next" value="/" />
  27.       <input type="submit" value="login" />
  28.     </form>
  29.   </body>
  30. </html>
  31.    
  32. python manage.py shell
  33. Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
  34. [GCC 4.5.2] on linux2
  35. Type "help", "copyright", "credits" or "license" for more information.
  36. (InteractiveConsole)
  37. >>> import django.contrib.auth.views
  38. >>> dir(django.contrib.auth.views)
  39. ['AuthenticationForm', 'HttpResponseRedirect', 'PasswordChangeForm', 'PasswordResetForm', 'QueryDict', 'REDIRECT_FIELD_NAME', 'RequestContext', 'SetPasswordForm', 'User', '_', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'auth_login', 'auth_logout', 'base36_to_int', 'csrf_protect', 'default_token_generator', 'get_current_site', 'login', 'login_required', 'logout', 'logout_then_login', 'never_cache', 'password_change', 'password_change_done', 'password_reset', 'password_reset_complete', 'password_reset_confirm', 'password_reset_done', 'redirect_to_login', 'render_to_response', 'reverse', 'settings', 'urlparse']
  40. >>>
  41. >>> dir(django.contrib.auth.views.login)
  42. ['__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__', '__doc__', '__format__', '__get__', '__getattribute__', '__globals__', '__hash__', '__init__', '__module__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name']
  43.    
  44. {% csrf_token %}
  45.    
  46. >>> from django.contrib.auth.views import AuthenticationForm
  47. >>> dir(AuthenticationForm)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top