Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HomePageView(TemplateView):
- template_name="home.html"
- def dispatch(self,request,*args,**kwargs):
- if not request.user.is_authenticated():
- raise http.Http404
- return super(HomePageView,self).dispatch(request,*args,**kwargs)
- {% extends "base.html" %}
- {% block content %}
- {% if user.is_authenticated %}
- ### display some user specic data
- {% else %}
- <form class="navbar-form navbar-right" role="form" action="" method="post">
- {% csrf_token %}
- {% if form.errors %}
- <p>Your username and password didn't match. Please try again.ohh!</p>
- {% endif %}
- <div class="form-group">
- {{ form.username.label_tag }}
- <input type="text" placeholder="Uname or Email" class="form-control" name="username">
- </div>
- <div class="form-group">
- <input type="password" placeholder="Password" class="form-control" name="password">
- </div>
- <button type="submit" class="btn btn-success">Sign in</button>
- </form>
- {% endif %}
- {% endblock %}
- urlpatterns = patterns('',
- # Examples:
- url(r'^$', HomePageView.as_view(), name='home'),)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement