Skip to content

Commit

Permalink
lot of work on templates, changed view to have transcript sort, accom…
Browse files Browse the repository at this point in the history
…odate project rename...need to learn to use nested git projects...derp
  • Loading branch information
Kevin Ngo committed May 29, 2011
1 parent f9c936c commit daa0cec
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 41 deletions.
Binary file modified database
Binary file not shown.
20 changes: 19 additions & 1 deletion main/templates/application.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

<html xmlns="http://www.w3.org/1999/xhml" xml:lang="en" lang="en">

<style type="text/css" media="all">
h1{display: inline;}
</style>

<head>
<link rel="stylesheet" type="text/css" href="/site_media/stylesheets/screen.css" />
<link rel="stylesheet" type="text/css" href="/site_media/stylesheets/print.css" />
Expand All @@ -11,17 +17,29 @@
<div class="container">
<div class="span-24 last">
<div class="span-14">
<span id="logo">OSU Registration</span>
<h1>Reggit</h1><span id="logo"> OSU Registration<br></span>
</div>

<div class="span-10 last">
{% block navigation %}
<span id="navigation" style="float: right;">
{% ifnotequal no_show_nav 1 %}
<a href="/main">Home</a> |
<a href="/make_schedule">Scheduler</a> |
<a href="/transcript">Transcript</a> |
<a href="/schedule">Current Schedule</a> |
<a href="/logout">Logout</a>
{% endifnotequal %}
</span>
{% endblock %}
</div>

</div>
{% block content %}
{% endblock %}
</div>
</body>

</html>


13 changes: 8 additions & 5 deletions main/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{% extends "application.html" %}

{% block content %}
<h1>Login</h1>
<form action="/login/" method="POST">
Username:<input name="username"></input><br/>
Password:<input type="password" name="password"></input><br/>
<input type="submit"/><br/>

<h1>Login</h1><br/></br>
<span>Enter your OSU ID/GAP or ONID</span>
<form action="/login/" method="POST" align="center">
Username:<input name="username"></input><br/>
Password:<input type="password" name="password"></input><br/>
<input type="submit" value="Login"><br/>
</form>

{% endblock %}
4 changes: 3 additions & 1 deletion main/templates/main.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "application.html" %}

{% block content %}
{{rc}}

<h1>Home</h1>

{% endblock %}

9 changes: 6 additions & 3 deletions main/templates/make_schedule.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{% extends "application.html" %}

{% block content %}

<h1>Scheduler</h1><br/><br/>

<form action="." method="POST">
<span>Enter a list of classes seperated commas</span>
<input name="classes" /></br>
<input type="submit" value="Submit" />
<span>Enter a list of classes separated commas</span><br/>
<input name="classes" /><input type="submit" value="Submit" />
<br/>
</form>

{% if combinations %}
Expand Down
4 changes: 2 additions & 2 deletions main/templates/schedule/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "application.html" %}

{% block content %}
<h1>Schedule</h1>
<h1>Schedule</h1><br/><br/>
{% for entry in schedule %}
<h4>{{entry.ClassName}}</h4>
<span>Type: {{ entry.ClassType }}</span></br>
Expand All @@ -17,7 +17,7 @@ <h4>{{entry.ClassName}}</h4>
<span>Registration: {{ entry.Registration }}</span><br/>
<span>CRN: {{ entry.CRN }}</span><br/>
<span>Grading Mode: {{ entry.GradingMode }}</span><br/>
<span>Credits: {{ entry.Credits }}</span><br/>
<span>Credits: {{ entry.Credits }}</span><br/><br/><br/>



Expand Down
4 changes: 2 additions & 2 deletions main/templates/transcript/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

{% block content %}

<h1>Transcript</h1>
<h1>Transcript</h1><br/><br/>

{% for entry in transcript %}
<h4>{{ entry.Name }}</h4>
<span>Department: {{entry.Department}}</span><br/>
<span>Course Number: {{entry.CourseNumber}}</span><br/>
<span>Term: {{entry.Term}} </span><br/>
<span>Grade: {{entry.Grade}} </span>
<span>Grade: {{entry.Grade}} </span><br/><br/>
{% endfor %}

{% endblock %}
42 changes: 19 additions & 23 deletions main/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from django.shortcuts import render_to_response
import simplejson as json
from django.http import HttpResponseRedirect
import registration
import reglib
# Create your views here.


def index(request):
if 'rc' in request.session:
if 'regclass' in request.session:
return HttpResponseRedirect('/main')
return render_to_response('index.html')
return render_to_response('index.html', {'no_show_nav': 1})

def login(request):
if 'rc' in request.session:
if 'regclass' in request.session:
return HttpResponseRedirect('/main')
if request.method == 'GET':
return render_to_response('index.html')
Expand All @@ -20,53 +19,50 @@ def login(request):
password = request.POST['password']

try:
rc_class = registration.infosu(username, password)
request.session['rc'] = rc_class
regclass = reglib.infosu(username, password)
request.session['regclass'] = regclass
return HttpResponseRedirect('/main')
except:
return HttpResponseRedirect('/')

def logout(request):
if 'rc' in request.session:
del(request.session['rc'])
del(request.session['regclass'])
return HttpResponseRedirect('/')

def main(request):
if not 'rc' in request.session:
if not 'regclass' in request.session:
return HttpResponseRedirect('/')
rc = request.session['rc']
return render_to_response('main.html', {'rc':rc})

regclass = request.session['regclass']
return render_to_response('main.html')

def transcript(request):
if not 'rc' in request.session:
if not 'regclass' in request.session:
return HttpResponseRedirect('/')

rc = request.session['rc']
transcript = rc.transcript.grades
regclass = request.session['regclass']
transcript = regclass.transcript.sort_by_term()
return render_to_response('transcript/index.html', {'transcript':transcript})

def schedule(request):
if not 'rc' in request.session:
if not 'regclass' in request.session:
return HttpResponseRedirect('/')

rc = request.session['rc']
schedule = rc.schedule.current_classes
regclass = request.session['regclass']
schedule = regclass.schedule.current_classes
return render_to_response('schedule/index.html', {'schedule':schedule})


def make_schedule(request):
if not 'rc' in request.session:
if not 'regclass' in request.session:
return HttpResponseRedirect('/')

if request.method == 'GET':
return render_to_response('make_schedule.html')
rc = request.session['rc']
regclass = request.session['regclass']
try:
classes = request.POST['classes'].split(', ')
except:
return render_to_response('make_schedule.html')
combinations = rc.make_schedule(classes)
combinations = regclass.make_schedule(classes)
combinations_json = json.dumps(combinations)

return render_to_response('make_schedule.html', {'combinations':combinations, 'json':combinations_json, 'range':range(24)})
Expand Down
4 changes: 2 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

# Django settings for regfe project.
# Django settings for reggit project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG
Expand Down Expand Up @@ -67,7 +67,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
)

ROOT_URLCONF = 'reggie.urls'
ROOT_URLCONF = 'reggit.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
Expand Down
2 changes: 1 addition & 1 deletion site_media/stylesheets/print.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
.quiet {color:#999;}
.hide {display:none;}
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
a:link:after, a:visited:after
2 changes: 1 addition & 1 deletion urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
from reggie import main
from reggit import main
from django.conf import settings

urlpatterns = patterns('',
Expand Down

0 comments on commit daa0cec

Please sign in to comment.