Commit fb4fc7b6 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

management app is also moving to the one page #whats-open-web app

parent 5700c9f8
import floppyforms as forms
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
from django.db import models
# Create your models here.
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
from django.conf.urls import patterns, include, url
from management.views import *
urlpatterns = patterns('',
url(r'^$', index, name='index'),
url(r'^login/$', mylogin, name='mylogin'),
)
from django.http import Http404
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.views.generic import FormView
from cas.views import login as caslogin
from management.forms import LoginForm
@login_required(login_url='/management/login')
def index(request):
return render_to_response('management/index.html')
def mylogin(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active and user.is_staff:
login(request,user)
return render_to_response('management/index.html')
else:
return render_to_response('403.html')
else:
return render_to_response('management/login.html')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment