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
whats-open
Commits
0e2d7e82
Commit
0e2d7e82
authored
Sep 15, 2012
by
Tyler Hallada
Browse files
Renaming alpha view to alpha_grid. It's more descriptive.
parent
e08c4cb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
website/urls.py
View file @
0e2d7e82
from
django.conf.urls
import
patterns
,
include
,
url
urlpatterns
=
patterns
(
'website.views'
,
url
(
r
'^$'
,
'alpha'
,
name
=
'alpha'
),
url
(
r
'^$'
,
'alpha
_grid
'
,
name
=
'alpha
_grid
'
),
)
website/views.py
View file @
0e2d7e82
...
...
@@ -3,8 +3,10 @@ from django.template import RequestContext
from
django.shortcuts
import
render_to_response
,
get_object_or_404
,
get_list_or_404
from
django.conf
import
settings
def
alpha
(
request
):
def
alpha_grid
(
request
):
restaurants
=
Restaurant
.
objects
.
all
()
#pass to django template
restRows
=
[
restaurants
[
x
:
x
+
4
]
for
x
in
xrange
(
0
,
len
(
restaurants
),
4
)]
return
render_to_response
(
'alpha.html'
,
{
'restaurants'
:
restRows
})
# Restaurants in lists of 4 to easily create rows in template
restRows
=
[
restaurants
[
x
:
x
+
4
]
for
x
in
xrange
(
0
,
len
(
restaurants
),
4
)]
return
render_to_response
(
'alpha.html'
,
{
'restRows'
:
restRows
,
'restaurants'
:
restaurants
})
whats_open/templates/alpha.html
View file @
0e2d7e82
...
...
@@ -2,7 +2,7 @@
{% block content %}
<!-- {% now "jS F Y H:i" %} -->
{% for list in rest
aurant
s %}
{% for list in rest
Row
s %}
<div
class =
"row"
>
{% for restaurant in list %}
<div
class =
"span3 {% if restaurant.isOpen %}open{% else %}closed{% endif %}"
>
...
...
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