Commit f366fee4 authored by Daniel Bond's avatar Daniel Bond
Browse files

Merge branch 'forms'

parents 024620c3 3cfdb8c8
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, HTML
from crispy_forms.bootstrap import PrependedText, AppendedText, FormActions
from accounts.models import Student
# form to create student
class StudentForm( forms.ModelForm ):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.layout = Layout(
'user',
PrependedText('room', 'Room'),
'class',
AppendedText('major', 'Major'),
)
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Submit'))
super(StudentForm, self).__init__(*args, **kwargs)
class Meta:
model = Student
{% extends 'layouts/base.html' %}
{% block title %} GMU RoomList | New Student Signup {% endblock %}
{% block content %}
{% load crispy_forms_tags %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-10 col-md-offset-2 text-center">
<h1><strong><a href="#">RoomList</a></strong> New Student Signup</h1>
</div>
</div>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title text-center"><strong>Student</strong></h1>
</div>
<div class="panel-body">
{% crispy form %}
</div>
</div>
</div>
</div>
{% endblock %}
from django.conf.urls import patterns, include, url
from accounts.views import DetailStudent
from accounts.views import DetailStudent, CreateStudent
from accounts.models import Student
from django.contrib import admin
......@@ -16,4 +16,10 @@ urlpatterns = patterns('',
context_object_name='student',
template_name='detailStudent.html'),
name='detailStudent'),
url(r'^create/$',
CreateStudent.as_view(
model=Student,
template_name="createStudent.html"),
name='createStudent'),
)
......@@ -3,9 +3,17 @@ from django.shortcuts import render
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView
from accounts.models import Student
from accounts.forms import StudentForm
from braces.views import LoginRequiredMixin
# create a student
class CreateStudent(LoginRequiredMixin, CreateView):
model = Student
form_class = StudentForm
success_url = '/' #redirect location tba
login_url = '/'
# details about the student
class DetailStudent(LoginRequiredMixin, DetailView):
model = Student
......
......@@ -71,6 +71,8 @@ INSTALLED_APPS = (
'django_gravatar',
)
CRISPY_TEMPLATE_PACK = 'bootstrap'
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
......
body {
min-height: 2000px;
padding-top: 70px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 80px;
}
......@@ -15,6 +15,11 @@ GMU RoomList &bull; Homepage
</div>
</div>
<div class="jumbotron">
<h1 class="text-center"></h1>
<p class="text-center">Lorem ipsum dolor sit amet. Freely licensed pictures from the #photos project?</p>
</div>
<div class="row">
</div>
......
......@@ -2,33 +2,26 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
{% load staticfiles %}
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/style.css" rel="stylesheet" media="screen">
<script src="/static/js/jquery-2.1.1.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<link rel="icon" href="/static/img/favicon.ico">
<meta charset="utf-8">
<meta name="description" content="Find your on campus neighbors">
<!-- <link rel="icon" href="path/to/favicon/"> -->
<title>
{% block title %}
{% endblock %}
</title>
<meta charset="utf-8">
<meta name="description" content="Find your on campus neighbors">
{% load staticfiles %}
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/style.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="/static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<link rel="icon" href="/static/img/favicon.ico">
<title> {% block title %} {% endblock %}</title>
</head>
<body>
<div id = "wrap">
{% include 'layouts/navbar.html' %}
{% block pagetitle %}
{% endblock %}
<div class="container">
{% block content %}
{% endblock %}
<div class="container">
{% block content %}
{% endblock %}
</div>
</div>
<div class="footer">
{% include 'layouts/footer.html' %}
</div>
{% include 'layouts/footer.html' %}
</body>
</html>
<div id="footer">
</div>
<footer class="footer">
<hr>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="col-md-8">
<a href="#">About</a> &middot;
<a href="#">Contact</a> &middot;
<a href="#">Terms of Service</a> &middot;
<a href="#">Privacy</a>
</div>
<div class="col-md-4">
<p class="muted pull-right">A <a href="http://srct.gmu.edu/projects">project</a> of <a href="http://www.gmu.edu/">Mason</a> <a href="http://srct.gmu.edu/"><strong>SRCT</strong></a>. <a href="https://www.gnu.org/licenses/gpl-3.0.html">Contribute</a> to <a href="http://git.gmu.edu/srct/roomlist/">our code</a>.</p>
</div>
</div>
</div>
</div>
</footer>
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