Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
roomlist
Commits
b36e08a4
Commit
b36e08a4
authored
Nov 18, 2014
by
Jason D Yeomans
Browse files
Linked buildings in building list to building page (shows rooms and occupants)
parent
6338c43b
Changes
8
Hide whitespace changes
Inline
Side-by-side
roomlist/api/migrations/0001_initial.pyc
View file @
b36e08a4
No preview for this file type
roomlist/api/migrations/0002_auto_20141009_2325.pyc
View file @
b36e08a4
No preview for this file type
roomlist/api/migrations/__init__.pyc
View file @
b36e08a4
No preview for this file type
roomlist/roomlist/urls.py
View file @
b36e08a4
...
...
@@ -6,4 +6,5 @@ admin.autodiscover()
urlpatterns
=
patterns
(
''
,
url
(
r
'^$'
,
views
.
index
,
name
=
'index'
),
url
(
r
'^buildings/$'
,
views
.
buildings
,
name
=
'buildings'
),
url
(
r
'^building/(?P<buildingName>[a-zA-Z]+)$'
,
views
.
building
,
name
=
'building'
),
)
roomlist/roomlist/views.py
View file @
b36e08a4
...
...
@@ -18,3 +18,13 @@ def buildings(request):
'building_list'
:
building_list
,
})
return
HttpResponse
(
template
.
render
(
context
))
def
building
(
request
,
buildingName
):
building
=
Building
.
objects
.
get
(
name__iexact
=
''
+
buildingName
)
room_list
=
Room
.
objects
.
filter
(
building__name
=
''
+
building
.
name
).
order_by
(
'number'
)
template
=
loader
.
get_template
(
'building.html'
)
context
=
RequestContext
(
request
,
{
'building'
:
building
,
'room_list'
:
room_list
,
})
return
HttpResponse
(
template
.
render
(
context
))
roomlist/templates/building.html
0 → 100644
View file @
b36e08a4
{% extends 'layouts/base.html' %} {% block title %} GMU RoomList
•
Homepage {% 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"
>
{{ building.name }}
</p>
</div>
</div>
</div>
<ul
style=
"list-style-type: none"
>
{% for room in room_list %}
<li>
{{ room.number }}
</li>
<li>
<ul>
<li>
{{ room.bedA }}
</li>
{% if room.bedB %}
<li>
{{ room.bedB }}
</li>
{% endif %}
{% if room.bedC %}
<li>
{{ room.bedC }}
</li>
{% endif %}
{% if room.bedD %}
<li>
{{ room.bedD }}
</li>
{% endif %}
</ul>
</li>
{% endfor %}
</ul>
{% endblock %}
roomlist/templates/buildings.html
View file @
b36e08a4
...
...
@@ -16,7 +16,7 @@ GMU RoomList • Homepage
<ul>
{% for building in building_list %}
<li>
{{ building.name }}
- {{ building.address }} {{ building.address.zip_code }}, {{ building.address.state}}
<a
href=
"/building/{{ building.name }}"
>
{{ building.name }}
</a>
- {{ building.address }} {{ building.address.zip_code }}, {{ building.address.state}}
</li>
{% endfor %}
</ul>
...
...
roomlist/templates/layouts/navbar.html
View file @
b36e08a4
...
...
@@ -7,12 +7,12 @@
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"/"
>
Project name
</a>
<a
class=
"navbar-brand"
href=
"/"
>
<strong>
GMU
</strong>
ROOMLIST
</a>
</div>
<div
id=
"navbar"
class=
"navbar-collapse collapse"
>
<ul
class=
"nav navbar-nav"
>
<li
class=
"active"
><a
href=
"
#
"
>
Home
</a></li>
<li><a
href=
"#about"
>
About
</a></li>
<li
class=
"active"
><a
href=
"
/
"
>
Home
</a></li>
<li><a
href=
"
/
#about"
>
About
</a></li>
<li><a
href=
"/buildings"
>
Buildings
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment