Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Daron
panikweb
Commits
4853b9ea
Commit
4853b9ea
authored
Aug 14, 2013
by
fred
Browse files
add times to grid lines
parent
a06c092e
Changes
6
Hide whitespace changes
Inline
Side-by-side
panikweb/paniktags/__init__.py
0 → 100644
View file @
4853b9ea
panikweb/paniktags/templatetags/__init__.py
0 → 100644
View file @
4853b9ea
panikweb/paniktags/templatetags/paniktags.py
0 → 100644
View file @
4853b9ea
from
django
import
template
register
=
template
.
Library
()
@
register
.
filter
(
name
=
'zip'
)
def
zip_lists
(
a
,
b
):
return
zip
(
a
,
b
)
panikweb/settings.py
View file @
4853b9ea
...
...
@@ -125,6 +125,7 @@ INSTALLED_APPS = (
'django.contrib.admin'
,
'django.contrib.admindocs'
,
'panikweb_templates'
,
'panikweb.paniktags'
,
'jquery'
,
'ckeditor'
,
'emissions'
,
...
...
panikweb/views.py
View file @
4853b9ea
...
...
@@ -54,6 +54,10 @@ class Grid(TemplateView):
nb_lines
=
2
*
24
# the cells are half hours
grid
=
[]
times
=
[
'%02d:%02d'
%
(
x
/
2
,
x
%
2
*
30
)
for
x
in
range
(
nb_lines
)]
# grid starts at 5am
times
=
times
[
2
*
5
:]
+
times
[:
2
*
5
]
nonstops
=
[[
0
,
2
,
'Biodiversite'
],
[
2
,
5
,
'Reveries'
],
[
5
,
7.5
,
'La Panique'
],
...
...
@@ -90,7 +94,7 @@ class Grid(TemplateView):
# start grid at 5am
grid
=
grid
[
2
*
5
:]
+
grid
[:
2
*
5
]
# merge adj
en
cent cells
# merge adj
a
cent cells
for
i
in
range
(
nb_lines
):
for
j
,
cell
in
enumerate
(
grid
[
i
]):
if
grid
[
i
][
j
]
is
None
:
...
...
@@ -124,6 +128,7 @@ class Grid(TemplateView):
pass
context
[
'grid'
]
=
grid
context
[
'times'
]
=
times
return
context
...
...
panikweb_templates/templates/grid.html
View file @
4853b9ea
{% extends "base.html" %}
{% load paniktags %}
{% block content %}
<h2>
Grille
</h2>
<table
border=
1
>
{% for time_
cells in
grid %}
{% for time_
header, time_cells in times|zip:
grid %}
<tr>
<td>
ti
:
me
</td>
<td>
{{
time
_header }}
</td>
{% for cell in time_cells %}
<td
{%
if
cell.w
>
1 %}colspan="{{cell.w}}"{% endif %}
{% if cell.h > 1 %}rowspan="{{cell.h}}"{% endif %}>{{ cell }}
</td>
{% endfor %}
<td>
ti
:
me
</td>
<td>
{{
time
_header }}
</td>
</tr>
{% endfor %}
</table>
...
...
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