Commit 5cad9aac authored by Daniel W Bond's avatar Daniel W Bond
Browse files

removed login from urls for housing app

parent 7beb2bf2
......@@ -8,33 +8,15 @@ from .models import Building, Floor, Room
urlpatterns = patterns('',
url(r'^$',
ListBuildings.as_view(
model=Building,
#paginate_by='10',
queryset=Building.objects.all(),
context_object_name='buildings',
template_name='list_buildings.html'),
name='list_buildings'),
ListBuildings.as_view(), name='list_buildings'),
url(r'^(?P<slug>[\w-]+)/(?P<building>[\w-]+)/$',
DetailBuilding.as_view(
model=Building,
slug_field='slug__iexact',
context_object_name='building',
template_name='detail_building.html'),
name='detail_building'),
DetailBuilding.as_view(), name='detail_building'),
url(r'^(?P<slug>[\w-]+)/(?P<building>[\w-]+)/(?P<floor>[\w-]+)/$',
DetailFloor.as_view(
model=Floor,
context_object_name='floor',
template_name='detail_floor.html'),
name='detail_floor'),
DetailFloor.as_view(), name='detail_floor'),
url(r'^(?P<slug>[\w-]+)/(?P<building>[\w-]+)/(?P<floor>[\w-]+)/(?P<room>[\w-]+)/$',
DetailRoom.as_view(
model=Room,
context_object_name='room',
template_name='detail_room.html'),
name='detail_room'),
DetailRoom.as_view(), name='detail_room'),
)
......@@ -11,7 +11,12 @@ from accounts.models import Student
# a list of neighborhoods and their buildings
class ListBuildings(LoginRequiredMixin, ListView):
model = Building
login_url = '/'
queryset = Building.objects.all()
# paginate_by =
context_object_name = 'buildings'
template_name = 'list_buildings.html'
login_url = 'login'
def get_context_data(self, **kwargs):
context = super(ListBuildings, self).get_context_data(**kwargs)
......@@ -23,16 +28,17 @@ class ListBuildings(LoginRequiredMixin, ListView):
# building floors, other information
class DetailBuilding(LoginRequiredMixin, DetailView):
model = Building
slug_field = 'slug__iexact'
context_object_name = 'building'
template_name='detailBuilding.html'
template_name='detail_building.html'
login_url = 'login'
def get_context_data(self, **kwargs):
context = super(DetailBuilding, self).get_context_data(**kwargs)
context['floors'] = Floor.objects.filter(building__name=''+self.get_object().name).order_by('number')
return context
login_url = '/'
# this lists the rooms on the floor
class DetailFloor(LoginRequiredMixin, DetailView):
model = Floor
......@@ -78,7 +84,7 @@ class DetailFloor(LoginRequiredMixin, DetailView):
class DetailRoom(LoginRequiredMixin, DetailView):
model = Room
context_object_name = 'room'
template_name='detailBuilding.html'
template_name='detail_room.html'
def get_context_data(self, **kwargs):
context = super(DetailRoom, self).get_context_data(**kwargs)
......
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