Commit 4d7b7340 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

floor views and modified filters

parent 9c7f2759
{% extends 'layouts/base.html' %}
{% block title %} SRCT RoomList • {{ floor.building.name }} {{ floor.number }}{% endblock %}
{% block content %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-12 text-center">
<h1><strong>GMU</strong>ROOMLIST</h1>
<p class="lead">{{ floor.building.name }}{{ floor.number }}</p>
</div>
</div>
</div>
{% for room in rooms %}
{{ room.number }}
{% endfor %}
{% endblock %}
...@@ -25,32 +25,33 @@ class DetailBuilding(LoginRequiredMixin, DetailView): ...@@ -25,32 +25,33 @@ class DetailBuilding(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(DetailBuilding, self).get_context_data(**kwargs) context = super(DetailBuilding, self).get_context_data(**kwargs)
context['room_list'] = Room.objects.filter(building__name=''+self.get_object().name).order_by('number') context['floors'] = Floor.objects.filter(building__name=''+self.get_object().name_.order_by('-number')
return context return context
login_url = '/' login_url = '/'
# this lists the rooms on the floor # this lists the rooms on the floor
class ListRooms(LoginRequiredMixin, ListView): class DetailFloor(LoginRequiredMixin, DetailView):
model = Room model = Floor
context_object_name = 'floor'
template_name = detail_floor.html
def get_context_data(self, **kwargs):
context = super(DetailFloor, self):
context['rooms'] = Room.objects.filter(floor=self.get_object()).order_by('-number')
return context
login_url = '/' login_url = '/'
# this lists students in a room # this lists students in a room
class DetailRoom(LoginRequiredMixin, ListView): class DetailRoom(LoginRequiredMixin, ListView):
model = Room model = Room
login_url = '/'
# update a student
#class UpdateStudent(LoginRequiredMixin, UpdateView):
# model = Student
# form_class = '/'
# success_url = '/' # change the success url to something more interesting
# login_url = '/' def get_context_data(self, **kwargs):
context = super(DetailRoom, self):
# context['students'] =
return context
# update a room login_url = '/'
#class updateroom(loginrequiredmixin, updateview):
# model = room
# form_class =
# success_url = '/' # change the success url to something more interesting
# login_url = '/' # deleted 'updateroom' view-- that will be handled on the user's page
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