From 2909dc657a865b3bf35707fa4599ecab0bfe3b8f Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 30 Dec 2011 00:06:08 +0100 Subject: add templates and first view for news --- .gitignore | 2 + sublab_project/news/templates/news/news_list.html | 10 ++ sublab_project/news/urls.py | 8 ++ sublab_project/templates/404.html | 13 ++ sublab_project/templates/500.html | 130 +++++++++++++++++++ sublab_project/templates/base.html | 151 ++++++++++++++++++++++ sublab_project/urls.py | 6 +- 7 files changed, 316 insertions(+), 4 deletions(-) create mode 100644 sublab_project/news/templates/news/news_list.html create mode 100644 sublab_project/news/urls.py diff --git a/.gitignore b/.gitignore index 903440c..14b79dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.db sublab_project/local_settings.py +*.pyc +*.swp diff --git a/sublab_project/news/templates/news/news_list.html b/sublab_project/news/templates/news/news_list.html new file mode 100644 index 0000000..ab998e8 --- /dev/null +++ b/sublab_project/news/templates/news/news_list.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{%block content %} + {% for post in news_list %} +

+ {{ post.date_updated|date }} - {{ post.title }} +

+

{{ post.content }}

+ {% endfor %} +{% endblock content %} diff --git a/sublab_project/news/urls.py b/sublab_project/news/urls.py new file mode 100644 index 0000000..a1c5c0a --- /dev/null +++ b/sublab_project/news/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls.defaults import patterns, include, url +from django.views.generic import ListView, DetailView + +from news.models import News + +urlpatterns = patterns('', + url(r'^$', ListView.as_view(model=News, paginate_by=8), name='news_list') +) diff --git a/sublab_project/templates/404.html b/sublab_project/templates/404.html index e69de29..0aab876 100644 --- a/sublab_project/templates/404.html +++ b/sublab_project/templates/404.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} + +{% block title %}sublab - page not found{% endblock %} + +{# {% block motd %}{% endblock %} #} +{% block content %} + Leider konnten wir die Datei zu Deiner Anfrage nicht finden. Eventuell + ist der Link den Du benutzt hast fehlerhaft oder veraltet. Falls Du der + Meinung bist, dass dieser Link funktionieren sollte, kontaktiere bitte + kontakt [at] sublab.org. + + Hier geht es zur Startseite. +{% endblock %} diff --git a/sublab_project/templates/500.html b/sublab_project/templates/500.html index e69de29..dd87d27 100644 --- a/sublab_project/templates/500.html +++ b/sublab_project/templates/500.html @@ -0,0 +1,130 @@ + + + + + sublab - page not found + + + + + + {# #} + {# #} + + + + + + + + + +
+
+ + + +
+

+ [ mate und technik ] +

+

+ Das sublab - ein Hackerspace in Leipzig +

+
+ + + +
+ +

+ Statusdisplay +

+
+
+ + + + + + + + + + + + + +
+ Taifun: + + Online  Offline +
+ Trieste: + + Online  Offline +
+ Nautilus: + + Online  Offline +
+
+
+

+ Mitglied werden +

+
+ +
+ Bei der Verarbeitung deiner Anfrage ist ein Fehler aufgetreten. Falls Du der + Meinung bist, dass das dieser Vorgang funktionieren sollte, kontaktiere bitte + kontakt [at] sublab.org.
+ Hier geht es zur Startseite. +
+
+ + + +
+
+ + + diff --git a/sublab_project/templates/base.html b/sublab_project/templates/base.html index e69de29..2c71ff7 100644 --- a/sublab_project/templates/base.html +++ b/sublab_project/templates/base.html @@ -0,0 +1,151 @@ + + + + + {% block title %}sublab - Ein Hackerspace in Leipzig{% endblock %} + + + + + {% if meta_date %}{% endif %} + + {# #} + {# #} + + + + + + + + + +
+
+ + + +
+

+ [ mate und technik ] +

+

+ Das sublab - ein Hackerspace in Leipzig +

+
+ + + +
+ +

+ Statusdisplay +

+
+
+ + + + + + + + + + + + + +
+ Taifun: + + Online  Offline +
+ Trieste: + + Online  Offline +
+ Nautilus: + + Online  Offline +
+
+
+

+ {% block motd %} + sublab website - jetzt mit Django + {% endblock %} +

+
+ Webcam im Fenster +
+ Temperaturen im sublab +
+

+ Mitglied werden +

+
+ +
+ {% block content %} + This is where the content would be. + {% endblock %} +
+
+ + + +
+
+ + + diff --git a/sublab_project/urls.py b/sublab_project/urls.py index c35dcb6..7d52b8b 100644 --- a/sublab_project/urls.py +++ b/sublab_project/urls.py @@ -1,4 +1,5 @@ from django.conf.urls.defaults import patterns, include, url +from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -6,12 +7,9 @@ admin.autodiscover() urlpatterns = patterns('', # Examples: - # url(r'^$', 'sublab_project.views.home', name='home'), - # url(r'^sublab_project/', include('sublab_project.foo.urls')), - # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), + url(r'^', include('news.urls')) ) -- cgit v1.2.1 From 4010503557051aabaa5b9f82c4cb29cf849e0a54 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 30 Dec 2011 00:06:58 +0100 Subject: add django-debug-toolbar --- conf/dev_settings.py | 11 ++++++++++- requirements.txt | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/conf/dev_settings.py b/conf/dev_settings.py index b61a979..1953653 100644 --- a/conf/dev_settings.py +++ b/conf/dev_settings.py @@ -1,6 +1,6 @@ import os -from settings import SITE_ROOT +from settings import SITE_ROOT, INSTALLED_APPS, MIDDLEWARE_CLASSES DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -11,3 +11,12 @@ DATABASES = { 'NAME': os.path.join(SITE_ROOT, 'sublab.db'), } } + +INSTALLED_APPS += ('debug_toolbar',) +MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) + +INTERNAL_IPS = ('127.0.0.1') + +DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': False, +} diff --git a/requirements.txt b/requirements.txt index b7a8960..770936f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Django==1.3.1 South==0.7.3 gunicorn==0.13.4 +django-debug-toolbar==0.8.5 -- cgit v1.2.1