Commit c9eab3a8 authored by Jason Yeomans's avatar Jason Yeomans
Browse files

lots of work

parent bf108ef6
from django.contrib import admin
from api.models import Class, Building, Address, Room
# Register your models here.
admin.site.register(Class)
admin.site.register(Building)
admin.site.register(Address)
admin.site.register(Room)
File added
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Address',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('street', models.CharField(max_length=100)),
('zip_code', models.IntegerField()),
('state', models.CharField(max_length=2)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Building',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=100)),
('address', models.ForeignKey(to='api.Address')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Class',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('year_int', models.IntegerField()),
('year_in_school', models.CharField(default=b'FR', max_length=2, choices=[(b'FR', b'Freshman'), (b'SO', b'Sophomore'), (b'JR', b'Junior'), (b'SR', b'Senior')])),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Room',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('number', models.IntegerField()),
('floor', models.IntegerField()),
('bedA', models.CharField(max_length=80)),
('bedB', models.CharField(max_length=80)),
('bedC', models.CharField(max_length=80)),
('bedD', models.CharField(max_length=80)),
('building', models.ForeignKey(to='api.Building')),
],
options={
},
bases=(models.Model,),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='address',
name='zip_code',
field=models.IntegerField(max_length=5),
),
]
from django.db import models
# Create your models here.
class Class(models.Model):
year_int = models.IntegerField()
FRESHMAN = 'FR'
SOPHOMORE = 'SO'
JUNIOR = 'JR'
SENIOR = 'SR'
YEAR_IN_SCHOOL_CHOICES = (
(FRESHMAN, 'Freshman'),
(SOPHOMORE, 'Sophomore'),
(JUNIOR, 'Junior'),
(SENIOR, 'Senior'),
)
year_in_school = models.CharField(max_length=2,
choices=YEAR_IN_SCHOOL_CHOICES,
default=FRESHMAN)
class Building(models.Model):
name = models.CharField(max_length=100)
address = models.ForeignKey('Address')
class Room(models.Model):
number = models.IntegerField()
floor = models.IntegerField()
bedA = models.CharField(max_length=80)
bedB = models.CharField(max_length=80)
bedC = models.CharField(max_length=80)
bedD = models.CharField(max_length=80)
building = models.ForeignKey('Building')
class Address(models.Model):
street = models.CharField(max_length=100)
zip_code = models.IntegerField(max_length=5)
state = models.CharField(max_length=2)
File added
from django.test import TestCase
# Create your tests here.
from django.conf.urls import patterns, url
from api import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)
File added
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Hello, world. You're at the RoomList index.")
File added
{% extends "admin/base.html" %}
{% block title %}{{ title }} | {{ site_title|default:_('RoomList Administration') }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">RoomList Administration</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
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