Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
radiopanik
panikweb
Commits
2dd74ecf
Commit
2dd74ecf
authored
Apr 06, 2015
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add month archives for agenda
parent
47ff4732
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
0 deletions
+44
-0
panikweb/urls.py
panikweb/urls.py
+2
-0
panikweb/views.py
panikweb/views.py
+19
-0
panikweb_templates/static/css/specifics.css
panikweb_templates/static/css/specifics.css
+4
-0
panikweb_templates/templates/agenda.html
panikweb_templates/templates/agenda.html
+19
-0
No files found.
panikweb/urls.py
View file @
2dd74ecf
...
...
@@ -22,6 +22,8 @@ urlpatterns = patterns('',
url
(
r
'^sons/archives/$'
,
'panikweb.search.listenArchives'
,
name
=
'listenArchives'
),
url
(
r
'^actus/$'
,
'panikweb.views.news'
,
name
=
'news'
),
url
(
r
'^actus/agenda/$'
,
'panikweb.views.agenda'
,
name
=
'agenda'
),
url
(
r
'^actus/agenda/(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$'
,
'panikweb.views.agenda_by_month'
,
name
=
'agenda_by_month'
),
url
(
r
'^actus/agenda$'
,
RedirectView
.
as_view
(
pattern_name
=
'agenda'
)),
url
(
r
'^actus/archives/$'
,
'panikweb.search.newsArchives'
,
name
=
'newsArchives'
),
url
(
r
'^actus/(?P<slug>[\w,-]+)$'
,
'panikweb.views.newsitemview'
,
name
=
'newsitem-view'
),
...
...
panikweb/views.py
View file @
2dd74ecf
...
...
@@ -13,6 +13,7 @@ from django.views.generic.base import TemplateView
from
django.views.generic.detail
import
DetailView
from
django.views.decorators.csrf
import
csrf_exempt
from
django.views.generic.dates
import
_date_from_string
from
django.views.generic.dates
import
MonthArchiveView
from
django.core.paginator
import
Paginator
...
...
@@ -476,11 +477,29 @@ class Agenda(TemplateView):
context
[
'agenda'
]
=
NewsItem
.
objects
.
filter
(
event_date__gte
=
date
.
today
()).
order_by
(
'date'
)[:
20
]
context
[
'news'
]
=
NewsItem
.
objects
.
all
().
order_by
(
'-date'
)
context
[
'previous_month'
]
=
datetime
.
today
().
replace
(
day
=
1
)
-
timedelta
(
days
=
2
)
return
context
agenda
=
Agenda
.
as_view
()
class
AgendaByMonth
(
MonthArchiveView
):
template_name
=
'agenda.html'
queryset
=
NewsItem
.
objects
.
filter
(
event_date__isnull
=
False
)
allow_future
=
True
date_field
=
'event_date'
month_format
=
'%m'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
AgendaByMonth
,
self
).
get_context_data
(
**
kwargs
)
context
[
'sectionName'
]
=
"News"
context
[
'agenda'
]
=
context
[
'object_list'
]
context
[
'news'
]
=
NewsItem
.
objects
.
all
().
order_by
(
'-date'
)
return
context
agenda_by_month
=
AgendaByMonth
.
as_view
()
class
Emissions
(
TemplateView
):
template_name
=
'emissions.html'
...
...
panikweb_templates/static/css/specifics.css
View file @
2dd74ecf
...
...
@@ -1559,3 +1559,7 @@ div.episode-detail div.sound div.download-links {
div
.extra-soundfiles
div
.download-links
{
background
:
white
;
}
div
.previous-and-next-months
{
margin-top
:
1em
;
}
panikweb_templates/templates/agenda.html
View file @
2dd74ecf
...
...
@@ -11,10 +11,14 @@
<div
class=
"detail marged news cf"
>
<div
class=
"wrapper navigation"
>
{% if month %}
<h2>
{{month|date:"E Y"}}
</h2>
{% else %}
<p
class=
"intro leftPart"
>
Tous les jours, il s'en passe des choses que Panik fomente, fait résonner et
vous fait savoir.
</p>
{% endif %}
<div
class=
"leftPart"
>
<div
class=
"news"
>
...
...
@@ -28,6 +32,21 @@ vous fait savoir.
{% if not agenda %}
<div
class=
"big error center"
>
Misère, c'est l'hiver ?!
</div>
{% endif %}
<div
class=
"previous-and-next-months"
>
<h4>
{% if previous_month %}
<a
href=
"{% url 'agenda_by_month' year=previous_month.year month=previous_month.month %}"
>
<
{{previous_month|date:'E Y'}}
</a>
{% endif %}
{% if previous_month and next_month %}—{% endif %}
{% if next_month %}
<a
href=
"{% url 'agenda_by_month' year=next_month.year month=next_month.month %}"
>
{{next_month|date:'E Y'}}
>
</a>
{% endif %}
</h4>
</div>
</div>
</div>
<div
class=
"rightPart"
>
...
...
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