Changeset - c5c40a039ec4
[Not reviewed]
default
0 1 1
Branko Majic (branko) - 11 years ago 2013-03-17 11:49:32
branko@majic.rs
Added a login page with custom template.
2 files changed with 31 insertions and 0 deletions:
0 comments (0 inline, 0 general)
conntrackt/templates/conntrackt/login.html
Show inline comments
 
new file 100644
 
{% extends "conntrackt/template.html" %}
 

	
 
{# For html_link #}
 
{% load conntrackt %}
 

	
 
{% block content %}
 

	
 
<div class="row">
 
  <div class="span4 offset4">
 
    {% if form.errors %}
 
    <p>Wrong username or password. Please try again.</p>
 
    {% endif %}
 
    <form method="post" action="{% url django.contrib.auth.views.login %}">
 
      {% csrf_token %}
 
      <fieldset>
 
        <legend>Login</legend>
 
        <label class="control-label" for="id_username">{{ form.username.label_tag }} {{ form.username }}</label>
 
        <label class="control-label" for="id_password">{{ form.password.label_tag }} {{ form.password }}</label>
 
        <button type="submit" class="btn">Login</button>
 
        <input type="hidden" name="next" value="{{next}}" />
 
      </fieldset>
 
    </form>
 
  </div>
 
</div>
 
{% endblock %}
 

	
conntrackt/urls.py
Show inline comments
 
# Import basic functions for URL pattern processing.
 
from django.conf.urls import patterns, url
 

	
 
# For logging-in the users
 
from django.contrib.auth.views import login
 

	
 
# For plain generic views
 
from conntrackt.models import Entity
 
from django.views.generic import DetailView
 
@@ -24,5 +27,7 @@ urlpatterns = patterns(
 
    url(r'^project/(?P<project_id>\d+)/iptables/$', get_project_iptables, name="project_iptables"),
 
    # View for rendering zip file with iptables rules for all entities in a project for a specific location.
 
    url(r'^project/(?P<project_id>\d+)/location/(?P<location_id>\d+)/iptables/$', get_project_iptables, name="project_location_iptables"),
 
    # View for logging-in the users.
 
    url(r'^login/$', login, {'template_name': 'conntrackt/login.html'}),
 
)
 

	
0 comments (0 inline, 0 general)