Commit 9c7f2759 authored by Daniel W Bond's avatar Daniel W Bond

added floor object

parent 44ac6dff
......@@ -2,7 +2,7 @@ from django.db import models
from autoslug import AutoSlugField
from model_utils.models import TimeStampedModel
from localflavor.us.models import USStateField
#from localflavor.us.models import USStateField
class Building(TimeStampedModel):
name = models.CharField(max_length=100)
......@@ -28,7 +28,7 @@ class Building(TimeStampedModel):
CAMPUS_CHOICES = (
(NONE, 'None'),
(PRINCE_WILLIAM, 'Prince William'),
(MASONVALE, 'mv'),
(MASONVALE, 'MasonVale'),
(FAIRFAX, 'Fairfax'),
)
......@@ -41,10 +41,16 @@ class Building(TimeStampedModel):
def __unicode__(self): # __unicode__ on Python 2
return unicode(self.name)
class Floor(TimeStampedModel):
building = models.ForeignKey('Building')
number = models.IntegerField()
def __str__(self): # __unicode__ on Python 2
return self.building.__str__()+" "+self.number.__str__()
class Room(TimeStampedModel):
number = models.IntegerField()
floor = models.IntegerField()
building = models.ForeignKey('Building')
floor = models.ForeignKey('Floor')
slug = AutoSlugField(populate_from='number', unique=True)
......
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