Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. class HomePageView(TemplateView):
  2.  
  3. template_name="home.html"
  4.  
  5. def dispatch(self,request,*args,**kwargs):
  6. if not request.user.is_authenticated():
  7. raise http.Http404
  8. return super(HomePageView,self).dispatch(request,*args,**kwargs)
  9.  
  10. {% extends "base.html" %}
  11. {% block content %}
  12. {% if user.is_authenticated %}
  13.  
  14. ### display some user specic data
  15. {% else %}
  16. <form class="navbar-form navbar-right" role="form" action="" method="post">
  17. {% csrf_token %}
  18. {% if form.errors %}
  19. <p>Your username and password didn't match. Please try again.ohh!</p>
  20. {% endif %}
  21. <div class="form-group">
  22.  
  23. {{ form.username.label_tag }}
  24. <input type="text" placeholder="Uname or Email" class="form-control" name="username">
  25. </div>
  26. <div class="form-group">
  27. <input type="password" placeholder="Password" class="form-control" name="password">
  28. </div>
  29. <button type="submit" class="btn btn-success">Sign in</button>
  30. </form>
  31. {% endif %}
  32. {% endblock %}
  33.  
  34. urlpatterns = patterns('',
  35. # Examples:
  36. url(r'^$', HomePageView.as_view(), name='home'),)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement