diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-02-17 09:39:46 -0800 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-02-17 09:39:46 -0800 |
| commit | d6655d4957b9e1654d1bfe262d093120def254ee (patch) | |
| tree | effe7dcb8f771f2c026fff9d067fb74c4ca84a56 | |
| download | famille-django-d6655d4957b9e1654d1bfe262d093120def254ee.tar.gz | |
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | __init__.py | 0 | ||||
| -rw-r--r-- | manage.py | 14 | ||||
| -rw-r--r-- | news/__init__.py | 0 | ||||
| -rw-r--r-- | news/admin.py | 5 | ||||
| -rw-r--r-- | news/models.py | 17 | ||||
| -rw-r--r-- | news/tests.py | 16 | ||||
| -rw-r--r-- | news/urls.py | 11 | ||||
| -rw-r--r-- | news/views.py | 33 | ||||
| -rw-r--r-- | settings.py | 153 | ||||
| -rw-r--r-- | static/gfx/.directory | 5 | ||||
| -rw-r--r-- | static/gfx/Sans titre.xcf | bin | 0 -> 87368 bytes | |||
| -rw-r--r-- | static/gfx/center.png | bin | 0 -> 351 bytes | |||
| -rw-r--r-- | static/gfx/center2.png | bin | 0 -> 381 bytes | |||
| -rw-r--r-- | static/gfx/center3.png | bin | 0 -> 262 bytes | |||
| -rw-r--r-- | static/gfx/exemple.png | bin | 0 -> 23347 bytes | |||
| -rw-r--r-- | static/gfx/gift.png | bin | 0 -> 21228 bytes | |||
| -rw-r--r-- | static/gfx/home.png | bin | 0 -> 6892 bytes | |||
| -rw-r--r-- | static/gfx/main.png | bin | 0 -> 231 bytes | |||
| -rw-r--r-- | static/gfx/main2.png | bin | 0 -> 188 bytes | |||
| -rw-r--r-- | static/gfx/main3.png | bin | 0 -> 205 bytes | |||
| -rw-r--r-- | static/gfx/menu.png | bin | 0 -> 25432 bytes | |||
| -rw-r--r-- | static/gfx/menu2.png | bin | 0 -> 222 bytes | |||
| -rw-r--r-- | static/gfx/news.png | bin | 0 -> 1667 bytes | |||
| -rw-r--r-- | static/gfx/ok.png | bin | 0 -> 1948 bytes | |||
| -rw-r--r-- | static/gfx/top.png | bin | 0 -> 337 bytes | |||
| -rw-r--r-- | static/style.css | 511 | ||||
| -rw-r--r-- | templates/base.html | 45 | ||||
| -rw-r--r-- | templates/news/news_detail.html | 41 | ||||
| -rw-r--r-- | templates/news/news_list.html | 23 | ||||
| -rw-r--r-- | templates/news/post.html | 8 | ||||
| -rw-r--r-- | urls.py | 11 |
32 files changed, 896 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67ab2e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +*~ +\#*\# diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/__init__.py diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..3e4eedc --- /dev/null +++ b/manage.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +from django.core.management import execute_manager +import imp +try: + imp.find_module('settings') # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) + sys.exit(1) + +import settings + +if __name__ == "__main__": + execute_manager(settings) diff --git a/news/__init__.py b/news/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/news/__init__.py diff --git a/news/admin.py b/news/admin.py new file mode 100644 index 0000000..95a693a --- /dev/null +++ b/news/admin.py @@ -0,0 +1,5 @@ +from news.models import News, Comment +from django.contrib import admin + +admin.site.register(News) +admin.site.register(Comment) diff --git a/news/models.py b/news/models.py new file mode 100644 index 0000000..fb9acc5 --- /dev/null +++ b/news/models.py @@ -0,0 +1,17 @@ +from django.db import models +from django.contrib.auth.models import User + +class News(models.Model): + text = models.TextField() + title = models.CharField(max_length=300) + date = models.DateTimeField(auto_now_add=True) + author = models.ForeignKey(User) + + def __unicode__(self): + return u'{} - {}'.format(self.title, self.date) + +class Comment(models.Model): + text = models.TextField() + author = models.ForeignKey(User) + date = models.DateTimeField(auto_now_add=True) + news = models.ForeignKey(News) diff --git a/news/tests.py b/news/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/news/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.assertEqual(1 + 1, 2) diff --git a/news/urls.py b/news/urls.py new file mode 100644 index 0000000..efd91b4 --- /dev/null +++ b/news/urls.py @@ -0,0 +1,11 @@ +from django.conf.urls.defaults import * +from news.views import NewsList, NewsView +from django.core.urlresolvers import reverse + +urlpatterns = patterns( + 'news.views', + url(r'^$', NewsList.as_view() ), + url(r'^post/$', 'post'), + url(r'^list/page(?P<page>[0-9]+)/$', NewsList.as_view() ), + url(r'^details/id/(?P<pk>[0-9]+)/$', NewsView.as_view(), name='news-details' ), +) diff --git a/news/views.py b/news/views.py new file mode 100644 index 0000000..8256b8d --- /dev/null +++ b/news/views.py @@ -0,0 +1,33 @@ +from django.shortcuts import render_to_response, redirect +from django.forms import ModelForm +from news.models import News +from django.views.generic import ListView, DetailView +from django.db.models import Count +from django.http import HttpResponseRedirect + +class NewsForm(ModelForm): + class Meta: + model = News + +class NewsList(ListView): + model = News + paginate_by= 5 + queryset = News.objects.annotate(Count('comment')).select_related('author__username') + context_object_name = 'news_list' + +class NewsView(DetailView): + model = News + context_object_name='news' + +def post(request): + if request.method == 'POST': + form = NewsForm(request.POST) + if form.is_valid(): + form.save() + return HttpResponseRedirect('') + else: + form = NewsForm() + + return render_to_response('news/post.html', { + 'form': form, + }) diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..074b2fc --- /dev/null +++ b/settings.py @@ -0,0 +1,153 @@ +import os +# Django settings for dfamille project. +PROJECT_DIR = os.path.dirname(__file__) +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'dfamille', # Or path to database file if using sqlite3. + 'USER': 'zaran', # Not used with sqlite3. + 'PASSWORD': 'Dlmatc06', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale +USE_L10N = True + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/home/media/media.lawrence.com/media/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" +MEDIA_URL = '' + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/home/media/media.lawrence.com/static/" +STATIC_ROOT = '' + +# URL prefix for static files. +# Example: "http://media.lawrence.com/static/" +STATIC_URL = '/static/' + +# URL prefix for admin static files -- CSS, JavaScript and images. +# Make sure to use a trailing slash. +# Examples: "http://foo.com/static/admin/", "/static/admin/". +ADMIN_MEDIA_PREFIX = '/static/admin/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + os.path.join(PROJECT_DIR, "static"), +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 't_z+-@fwe5(tceiyy0=-bt^6&fln_mrrko&gcw3t5_=!=d_%r^' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +# 'django.template.loaders.eggs.Loader', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + #'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware' +) + +ROOT_URLCONF = 'dfamille.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + os.path.join(PROJECT_DIR, "templates"), +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'news', + # Uncomment the next line to enable the admin: + 'django.contrib.admin', + # Uncomment the next line to enable admin documentation: + # 'django.contrib.admindocs', + 'debug_toolbar', +) + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} + +INTERNAL_IPS = ('127.0.0.1') diff --git a/static/gfx/.directory b/static/gfx/.directory new file mode 100644 index 0000000..8dd99f8 --- /dev/null +++ b/static/gfx/.directory @@ -0,0 +1,5 @@ +[Dolphin] +AdditionalInfo=3 +ShowPreview=true +Timestamp=2009,10,2,15,21,34 +ViewMode=1 diff --git a/static/gfx/Sans titre.xcf b/static/gfx/Sans titre.xcf Binary files differnew file mode 100644 index 0000000..51e0b0e --- /dev/null +++ b/static/gfx/Sans titre.xcf diff --git a/static/gfx/center.png b/static/gfx/center.png Binary files differnew file mode 100644 index 0000000..ca1a07d --- /dev/null +++ b/static/gfx/center.png diff --git a/static/gfx/center2.png b/static/gfx/center2.png Binary files differnew file mode 100644 index 0000000..562d987 --- /dev/null +++ b/static/gfx/center2.png diff --git a/static/gfx/center3.png b/static/gfx/center3.png Binary files differnew file mode 100644 index 0000000..2d77411 --- /dev/null +++ b/static/gfx/center3.png diff --git a/static/gfx/exemple.png b/static/gfx/exemple.png Binary files differnew file mode 100644 index 0000000..ece5186 --- /dev/null +++ b/static/gfx/exemple.png diff --git a/static/gfx/gift.png b/static/gfx/gift.png Binary files differnew file mode 100644 index 0000000..d2c26ec --- /dev/null +++ b/static/gfx/gift.png diff --git a/static/gfx/home.png b/static/gfx/home.png Binary files differnew file mode 100644 index 0000000..708f40c --- /dev/null +++ b/static/gfx/home.png diff --git a/static/gfx/main.png b/static/gfx/main.png Binary files differnew file mode 100644 index 0000000..94871c7 --- /dev/null +++ b/static/gfx/main.png diff --git a/static/gfx/main2.png b/static/gfx/main2.png Binary files differnew file mode 100644 index 0000000..9ac7527 --- /dev/null +++ b/static/gfx/main2.png diff --git a/static/gfx/main3.png b/static/gfx/main3.png Binary files differnew file mode 100644 index 0000000..1f2de24 --- /dev/null +++ b/static/gfx/main3.png diff --git a/static/gfx/menu.png b/static/gfx/menu.png Binary files differnew file mode 100644 index 0000000..e3a5fc7 --- /dev/null +++ b/static/gfx/menu.png diff --git a/static/gfx/menu2.png b/static/gfx/menu2.png Binary files differnew file mode 100644 index 0000000..3649ed3 --- /dev/null +++ b/static/gfx/menu2.png diff --git a/static/gfx/news.png b/static/gfx/news.png Binary files differnew file mode 100644 index 0000000..cf08762 --- /dev/null +++ b/static/gfx/news.png diff --git a/static/gfx/ok.png b/static/gfx/ok.png Binary files differnew file mode 100644 index 0000000..3914340 --- /dev/null +++ b/static/gfx/ok.png diff --git a/static/gfx/top.png b/static/gfx/top.png Binary files differnew file mode 100644 index 0000000..89dd911 --- /dev/null +++ b/static/gfx/top.png diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..a5ad5e0 --- /dev/null +++ b/static/style.css @@ -0,0 +1,511 @@ +/**************************/ +/** Structure de la page **/ +/**************************/ + +body { +font-family: arial; +font-size: 14px; +padding:0; +margin:0; +background-color: #45395f; +background-image : url('gfx/main.png'); +background-repeat : repeat; +} + +.sheet{ +background-color : white; +width:950px; +margin-left:auto; +margin-right:auto; +margin-top:0px; +margin-bottom : 0x; +padding-top:0px; +} + +.main { +width : 900px; +padding-left : 25px; +padding-right : 25px; +padding-top : 15px; +padding-bottom : 15px; +margin-left:auto; +margin-right:auto; +margin-top:0px; +margin-bottom : 0x; +color : black; +height : 100%; +background-image : url('gfx/center3.png'); +background-repeat : repeat-x; +} + +.container{ +width : 1040px; +background-image : url('gfx/center.png'); +background-repeat : repeat-y; +margin-left:auto; +margin-right:auto; +} + +/*****************************************/ +/** Eléments communs à toutes les pages **/ +/*****************************************/ + +.main_menu{ +width: 900px; +margin-left:auto; +margin-right:auto; +padding-left : 25px; +padding-right : 25px; +height:50px; +background-image : url('gfx/menu2.png'); +background-repeat : repeat-x; +border-bottom : 2px groove black; +border-top : 1px groove black; +text-align:center; +} + +.main_menu a{ +color : white; +font-size : 20px; +} + +.main_menu a:hover{ +text-decoration : none; +color : white; +} + +.main_menu td{ +height:50px; +padding-left : 15px; +padding-right: 15px; +border-left:2px groove #002B56; +border-right:2px groove #002B56; +border-bottom : none; +} + +.main_menu td:hover{ +border-bottom : 3px solid #EA8500; +} + +.top{ +margin : 0px; +padding : 0px; +height : 70px; +padding : 5px; +text-align : right; +color: black; +font-size:15px; +background-image : url('gfx/top.png'); +} + +.top:before{ +content : url('gfx/home.png'); +float:left; +margin-left:20px; +} + +.top p{ +margin-top:25px; +} + +/***************************************************/ +/** mise en forme générale pour un style cohérent **/ +/***************************************************/ + +h1{ +text-align : center; +font-size : 25px; +} + +a{ +text-decoration : none; +color : #0060A4; +} + +a:hover{ +text-decoration : underline; +color : #EA8500; +} + +.info { +font-style : italic; +} + +form{ +display : block; +margin-left : auto; +margin-right : auto; +} + +label{ +display : block; +float:left; +text-align : right; +padding-right : 5px; +font-weight : bold; +margin-bottom : 5px; +} + +input { +border : 1px solid #13294B; +background-color : #EDF0FF; +margin-bottom : 5px; +} + +input:focus,select:focus { +background-color : #B9CEFF; +} + +input[type=button],[type=submit]{ +background-color : #B9CEFF; +color : black; +-moz-border-radius : 5px; +} + +textarea{ +border : 1px solid #13294B; +background-color : #EDF0FF; +} + +legend { +border : 1px solid #13294B; +background-color : #EDF0FF; +} + +fieldset{ +border : 1px solid #13294B; +margin-bottom : 10px; +} + +select{ +background-color : #EDF0FF; +border : 1px solid #13294B; +margin-bottom : 5px; +} + +form p.submit{ +text-align : center; +} + + +pre.code{ +border : 1px solid #003669; +background-color : #F2F2F2; +width : 650px; +margin-left:auto; +margin-right:auto; +padding : 5px; +white-space: pre-wrap; +} + +hr{ +color : #BFBFBF; +border : none; +background-color : #BFBFBF; +height : 1px; +} + +.hidden{ +display : none; +} + +/***************************/ +/** Elements particuliers **/ +/***************************/ + +.news{ +float : left; +width : 650px; +padding-right : 15px; +border-right : 3px dotted gray; +} + +.article{ +width : 750px; +margin-left : auto; +margin-right : auto; +line-height:130% +} + +.news_add label{ +width : 100px; +} + +.news_add textarea{ +width : 650px; +} + +.comment_add textarea{ +width : 650px; +} + +.news_add input[type=text]{ +display : block; +width : 650px; +} + +.news_head{ +/* border-bottom : 1px solid #0060A4; */ +border-bottom : 1px solid #BFBFBF; +} + +.news_head h2{ +margin-bottom : 5px; +font-size : 18px; +} + +.news_head:before{ +content : url('gfx/news.png'); +float:left; +padding-top : 8px; +margin-right : 5px; +} + +.news_head p{ +margin : 0px; +margin-bottom : 5px; +} + +.news p.comments{ +margin-top:0px; +text-align : right; +} + +.quickview{ +width : 220px; +float:right; +} + +.quickview h2{ +margin : 0px; +padding:0px; +background-color : #BFBFBF; +-moz-border-radius : 5px; +-khtml-border-radius : 5px; +padding-top : 3px; +padding-bottom : 3px; +color : white; +text-align : center; +font-size : 17px; +} + +.quickview ul{ +list-style : none; +padding-left:0px; +} + +.quickview li{ +margin-bottom : 8px; +} + +.quickview li:before{ +content : "> "; +color : gray; +} + +.quickview td{ +border: 0px; +} + +.quickview table{ +margin-bottom : 10px; +} + +form.userform { +display : block; +margin-left : auto; +margin-right : auto; +width : 600px; +} + +form.userform label{ +width : 200px; +} + +.comment_content{ +border : 1px solid #BFBFBF; +-moz-border-radius-bottomleft : 10px; +-moz-border-radius-bottomright : 10px; +-khtml-border-bottom-left-radius : 10px; +-khtml-border-bottom-right-radius : 10px; +padding : 5px; +margin-bottom : 20px; + +} + +h3.comment{ +margin : 0px; +padding-left:5px; +border : 1px solid #BFBFBF; +-moz-border-radius-topleft : 7px; +-moz-border-radius-topright : 7px; +-khtml-border-top-left-radius : 7px; +-khtml-border-top-right-radius : 7px; +background-color : #BFBFBF; +font-weight : normal; +font-size : 15px; + +} + +.second_menu{ +text-align:center; +} + +#connection label{ +width:150px; +} + +form#connection{ +position : absolute; +top:50%; +left:50%; +margin-left:-320px; +margin-top:-95px; +padding:20px; +display : block; +width:600px; +height:160px; +background-color : white; +border : 5px solid #1E5E7C; +} + +#connection fieldset{ +margin : 0px; +} + +.infobox { +margin-left:auto; +margin-right:auto; +border : 2px solid #3A8433; +width : 500px; +margin-top : 20px; +margin-bottom : 20px; +padding-left : 15px; +padding-right : 15px; +padding-top : 5px; +padding-bottom : 5px; +background-color : #ACFFA4; +font-size : 15px; +} + +.infobox:before { +float:left; +content : url('gfx/ok.png'); +} + +.errorbox { +margin-left:auto; +margin-right:auto; +border : 2px solid #912B2D; +width : 500px; +margin-top : 20px; +margin-bottom : 20px; +padding-left : 15px; +padding-right : 15px; +padding-top : 5px; +padding-bottom : 5px; +background-color : #FF4C4F; +} + + +table { +border-collapse : collapse; +margin-left : auto; +margin-right : auto; +} + +th { +border-bottom : 2px solid #434343; +} + +td { +border-bottom : 1px dotted gray; +padding : 5px; +} + +.file th{ +border:none; +border-bottom: 2px solid black; +} + +.file td{ +border:none; +} + +caption{ +text-align : center; +margin-bottom : 10px; +font-size : 18px; +font-weight : bold; +} + +.upgraded{ +color : green; +} + +.installed{ +color : green; +} + +.removed{ +color : red; +} + +.date{ +font-style : italic; +} + +.news_content table +{ +border-collapse:collapse; +} + +.news_content table, th, td +{ +border: 1px solid #003669; +} + +.news_content th{ +background-color : #9AB7FF; +} + +.news_content a img{ +border-style:none; +} + +.news_content img{ +margin-right:10px; +margin-top:0px; +margin-bottom:0px; +margin-left:10px; +} + +.news_content .caption{ +border :1px solid gray; +padding:7px; +} + +.sommaire{ +display : table-cell; +border : 1px solid #003669; +list-style-type : none; +padding : 10px; +} + +.sommaire ul{ +list-style-type : none; +} + +.sommaire:before{ +content : "Sommaire"; +display : block; +width : 70px; +margin-left: auto; +margin-right : auto; +font-weight : bold; +} + + + + + diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..1e2580f --- /dev/null +++ b/templates/base.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> + <title>{% block title %}Site de la famille{% endblock title %}</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="stylesheet" media="screen" type="text/css" title="Design" href="/static/style.css" /> + <link rel="alternate" type="application/rss+xml" title="Les actualités" href="rss.xml" /> + <link rel="icon" type="image/png" href="/views/favicon.png" /> + <script src="/library/jquery.js" type="text/javascript"></script> + <script type="text/javascript"> + $.fn.wait = function(time, type) { + time = time || 1000; + type = type || "fx"; + return this.queue(type, function() { + var self = this; + setTimeout(function() { + $(self).dequeue(); + }, time); + }); + }; + </script> +</head> +<body> +<div class="container"> +<div class="sheet"> +<div class="top"> + <p><strong><?=$_SESSION['username']?></strong> (<a href="/user/edit">Mon compte</a> | <a href="/disconnect.php">Se déconnecter</a>)</p> +</div> +<div class="main_menu"> + <table> + <tr> + <td><a href="/">Accueil</a></td> + <td><a href="/article/">Articles</a></td> + <td><a href="/user/">Famille</a></td> + <td><a href="/system/">Système</a></td> + </tr> +</table> +</div> +<div class="main"> +{% block content %}{% endblock %} +</div> +</div> +</div> +</body> +</html> diff --git a/templates/news/news_detail.html b/templates/news/news_detail.html new file mode 100644 index 0000000..f65b91e --- /dev/null +++ b/templates/news/news_detail.html @@ -0,0 +1,41 @@ +{% extends 'base.html' %} + +{% block content %} +{% with news.comment_set.all as comments %} +<div class="quickview"/> +<h2>Détails</h2> +<ul> + <li>Auteur : <a href="/user/view/name/<?=$this->news['name']?>">{{news.author}}</a></li> +<li>Date : {{news.date}} </li> +<li><a href="#comments">{{coments}}</a></li> +</div> + +<div class="news"/> +<h1>{{news.title}}</h1> + +<div class="news_content"> +{{news.text}} +</div> + +<hr/> + +<h2 id="comments">Commentaires</h2> +{% for comment in comments %} +<h3 class="comment">Posté par <a href="/user/view/name/<?=$comment['name']?>">{{comment.author}}</a> le {{comment.date}} </h3> +<div class="comment_content"/> +{{comment.text}} +</div> +{% endfor %} + +<h2 id="add">Ajouter un commentaire</h2> + +<form class="comment_add" method="post" action="/home/view/id/<?=$this->news['id']?>/#add"> +<textarea name="content" cols="90" rows="10"> +</textarea> + +<p class="submit"><input type="submit" value="Ajouter"/></p> +</div> + +<div style="clear:both"/> +{% endwith %} +{% endblock %} diff --git a/templates/news/news_list.html b/templates/news/news_list.html new file mode 100644 index 0000000..2119a68 --- /dev/null +++ b/templates/news/news_list.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} + +{% block content %} +<div class="news"> + {% for news in news_list %} + <div class="news_head"> + <h2><a href="{% url news-details pk=news.id %}">{{ news.title }}</a></h2> + <!--div style="float:right"><a href="/home/edit/id/<?=$news['ident']?>">Modifier cette actualité</a></div--> + <p>Posté par <a href="/user/view/name/<?=$news['name']?>">{{ news.author.username }}</a> le {{ news.date }}</p> + </div> + + <p class="comments">{% with news.comment__count as comment_count %} + <a href="{% url news-details pk=news.id %}#comment">{{ comment_count }} commentaire{{comment_count|pluralize}}</a> | + <a href="{% url news-details pk=news.id %}#add">Ajouter un commentaire</a> + </p>{% endwith %} + + <div class="news_content"> + {{ news.text }} + </div> + {% endfor %} +</div> +<div style="clear:both"/> +{% endblock %} diff --git a/templates/news/post.html b/templates/news/post.html new file mode 100644 index 0000000..56ad2e4 --- /dev/null +++ b/templates/news/post.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} + +{% block content %} +<form action="{% url news.views.post %}" method="post"> +{{ form.as_p }} +<input type="submit" value="Submit" /> +</form> +{% endblock %} @@ -0,0 +1,11 @@ +from django.conf.urls.defaults import patterns, include, url +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns( + '', + # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), + url(r'^admin/', include(admin.site.urls)), + url(r'^news/', include('news.urls')), + url(r'^$', include('news.urls')) +) |
