diff options
author | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2012-01-06 09:28:13 +0100 |
---|---|---|
committer | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2012-01-06 09:28:13 +0100 |
commit | 0dd0d9c44722f4d4b16fe5654c634b5ac2337f13 (patch) | |
tree | 661af0ef39bff99a31e20086fae7025a190a83f9 | |
parent | 50207143df534b12dc100e9db2b84ff84ea2a9e2 (diff) |
Added view for all events. CSS needs some love.
-rw-r--r-- | sublab_project/calendarium/templates/calendarium/list_events.html | 20 | ||||
-rw-r--r-- | sublab_project/calendarium/urls.py | 6 | ||||
-rw-r--r-- | sublab_project/calendarium/views.py | 14 | ||||
-rw-r--r-- | sublab_project/urls.py | 2 |
4 files changed, 41 insertions, 1 deletions
diff --git a/sublab_project/calendarium/templates/calendarium/list_events.html b/sublab_project/calendarium/templates/calendarium/list_events.html new file mode 100644 index 0000000..6e0b4d4 --- /dev/null +++ b/sublab_project/calendarium/templates/calendarium/list_events.html @@ -0,0 +1,20 @@ +{% extends 'base.html' %} + +{% block title %}Termine{% endblock %} + +{%block content %} + <h2>Termine</h2> + <p>Hier findest du Veranstaltungen, die im sublab und dessen Umgebung stattfinden.</p> + <h3>Veranstaltungen im sublab</h3> + <ul class="events"> + {% for event in events_source_import %} + <li>{{ event.start|date:"l, j. F Y H:i" }} bis {{ event.end|date:"H:i" }} Uhr - {{ event.name }}<br/>{{ event.description }}</li> + {% endfor %} + </ul> + <h3>Was sonst noch los ist</h3> + <ul class="events"> + {% for event in events_source_admin %} + <li>{{ event.start|date:"l, j. F Y H:i" }} bis {{ event.end|date:"l, j. F Y H:i" }} Uhr - {{ event.name }}<br/>{{ event.description }}</li> + {% endfor %} + </ul> +{% endblock content %} diff --git a/sublab_project/calendarium/urls.py b/sublab_project/calendarium/urls.py new file mode 100644 index 0000000..002e1e2 --- /dev/null +++ b/sublab_project/calendarium/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls.defaults import patterns, include, url + + +urlpatterns = patterns('calendarium.views', + url('^$', 'list_events', name='calendarium_list_events'), +) diff --git a/sublab_project/calendarium/views.py b/sublab_project/calendarium/views.py index 60f00ef..4b11c7b 100644 --- a/sublab_project/calendarium/views.py +++ b/sublab_project/calendarium/views.py @@ -1 +1,13 @@ -# Create your views here. +from django.shortcuts import render + +from models import Event + + +def list_events(request): + """Displays all events grouped by source. + """ + context = { + 'events_source_import': Event.objects.filter(source=Event.SOURCE_IMPORT), + 'events_source_admin': Event.objects.filter(source=Event.SOURCE_ADMIN), + } + return render(request, 'calendarium/list_events.html', context) diff --git a/sublab_project/urls.py b/sublab_project/urls.py index 94c46ff..40c4822 100644 --- a/sublab_project/urls.py +++ b/sublab_project/urls.py @@ -8,6 +8,7 @@ admin.autodiscover() from news.models import News + urlpatterns = patterns('', # Examples: # Uncomment the admin/doc line below to enable admin documentation: @@ -16,6 +17,7 @@ urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^projekte/', include('projects.urls')), url(r'^news/', include('news.urls')), + url(r'^termine/', include('calendarium.urls')), url(r'^$', ListView.as_view( queryset=News.objects.all()[:5], template_name='home.html'), name='home'), |