Commit e3994068 authored by Jason D Yeomans's avatar Jason D Yeomans
Browse files

Merge branch 'master' of git.gmu.edu:srct/roomlist

parents ffc5b4be 74a9cd03
from django.db import models
from autoslug import AutoSlugField
from model_utils.models import TimeStampedModel
from django.contrib.auth.models import User
from localflavor.us.models import USStateField
class Building(TimeStampedModel):
name = models.CharField(max_length=100)
......@@ -44,11 +45,12 @@ class Room(TimeStampedModel):
def __str__(self): # __unicode__ on Python 2
return self.building.__str__()+" "+self.number.__str__()
class Address(TimeStampedModel):
street = models.CharField(max_length=100)
street = models.CharField(max_length=120)
city = models.CharField(max_length=120)
state = USStateField()
zip_code = models.IntegerField(max_length=5)
state = models.CharField(max_length=2)
class Meta:
verbose_name_plural = 'addresses'
......@@ -56,7 +58,6 @@ class Address(TimeStampedModel):
def __str__(self): # __unicode__ on Python 2
return self.street
class Class(TimeStampedModel):
year_int = models.IntegerField()
FRESHMAN = 'FR'
......@@ -75,6 +76,5 @@ class Class(TimeStampedModel):
class Meta:
verbose_name_plural = 'classes'
def __str__(self): # __unicode__ on Python 2
return str(self.year_int)
......@@ -13,8 +13,20 @@ GMU RoomList • Homepage
</div>
</div>
<legend>Rappahannock</legend>
<ul>
{% for building in rappahannock %}
<li>
<a href="/housing/buildings/{{ building.name }}">{{ building.name }}</a> - {{ building.address }} {{ building.address.zip_code }}, {{ building.address.state}}
</li>
{% endfor %}
</ul>
<legend>Shenandoah</legend>
<ul>
{% for building in buildings %}
{% for building in shenandoah %}
<li>
<a href="/housing/buildings/{{ building.name }}">{{ building.name }}</a> - {{ building.address }} {{ building.address.zip_code }}, {{ building.address.state}}
</li>
......
......@@ -10,6 +10,13 @@ class ListBuildings(LoginRequiredMixin, ListView):
model = Building
login_url = '/'
def get_context_data(self, **kwargs):
context = super(ListBuildings, self).get_context_data(**kwargs)
context['rappahannock'] = Building.objects.filter(neighbourhood='ra')
context['shenandoah'] = Building.objects.filter(neighbourhood='sh')
context['aquia'] = Building.objects.filter(neighbourhood='aq')
return context
# building floors, other information
class DetailBuilding(LoginRequiredMixin, DetailView):
model = Building
......
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