From 2ebcf6cf58581acfc718e7242e6f18b25ecbe1a2 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 27 Dec 2011 18:35:42 +0530 Subject: [PATCH] added pages app --- itf/festival/models.py | 2 ++ itf/pages/__init__.py | 0 itf/pages/admin.py | 12 ++++++++++++ itf/pages/models.py | 12 ++++++++++++ itf/pages/tests.py | 16 ++++++++++++++++ itf/pages/views.py | 9 +++++++++ itf/settings.py | 3 ++- itf/templates/modules/emailer/emailerissue.html | 1 + itf/templates/noel/insidepage.html | 13 ++++++------- itf/urls.py | 1 + 10 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 itf/pages/__init__.py create mode 100755 itf/pages/admin.py create mode 100644 itf/pages/models.py create mode 100644 itf/pages/tests.py create mode 100644 itf/pages/views.py diff --git a/itf/festival/models.py b/itf/festival/models.py index 15d43fd..0d98a27 100755 --- a/itf/festival/models.py +++ b/itf/festival/models.py @@ -110,6 +110,8 @@ class Participant(ItfModel): 'meetings': self.meetings.all() } + class Meta: + ordering = ['name'] class Talk(models.Model): title = models.CharField(max_length=255) diff --git a/itf/pages/__init__.py b/itf/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/pages/admin.py b/itf/pages/admin.py new file mode 100755 index 0000000..afe5f49 --- /dev/null +++ b/itf/pages/admin.py @@ -0,0 +1,12 @@ +from django.contrib import admin +from models import * +# from forms import ArticleForm + +class PageAdmin(admin.ModelAdmin): + prepopulated_fields = {'slug': ('title',)} +# search_fields = ('title', 'synopsis',), +# list_display = ('title', 'date',) + + +admin.site.register(Page, PageAdmin) + diff --git a/itf/pages/models.py b/itf/pages/models.py new file mode 100644 index 0000000..38e1277 --- /dev/null +++ b/itf/pages/models.py @@ -0,0 +1,12 @@ +from django.db import models + +class Page(models.Model): + title = models.CharField(max_length=255) + slug = models.SlugField(max_length=64) + main_image = models.ImageField(upload_to='upload/images/pages/', blank=True, null=True) + text = models.TextField(blank=True) + + def __unicode__(self): + return self.title + +# Create your models here. diff --git a/itf/pages/tests.py b/itf/pages/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/itf/pages/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/itf/pages/views.py b/itf/pages/views.py new file mode 100644 index 0000000..057e265 --- /dev/null +++ b/itf/pages/views.py @@ -0,0 +1,9 @@ +# Create your views here. +from django.shortcuts import render_to_response, get_object_or_404 +from models import Page +from django.template import RequestContext + +def render_page(request, slug): + page = get_object_or_404(Page, slug=slug) + context = RequestContext(request, {'page': page}) + return render_to_response("noel/staticpage.html", context) diff --git a/itf/settings.py b/itf/settings.py index 7145757..a2e1b5e 100755 --- a/itf/settings.py +++ b/itf/settings.py @@ -34,7 +34,7 @@ AUTH_PROFILE_MODULE = "profiles.Person" LOGIN_REDIRECT_URL = "/t/" ADMINS = ( - # ('Your Name', 'your_email@domain.com'), + ('Sanjay B', 'sanjaybhangar@gmail.com'), ) INTERNAL_IPS = ('127.0.0.1',) @@ -160,6 +160,7 @@ INSTALLED_APPS = ( 'scriptbank', 'bestpractices', 'emailer', + 'pages', 'tagging', 'app', 'api', diff --git a/itf/templates/modules/emailer/emailerissue.html b/itf/templates/modules/emailer/emailerissue.html index 49b2aea..53b47ea 100755 --- a/itf/templates/modules/emailer/emailerissue.html +++ b/itf/templates/modules/emailer/emailerissue.html @@ -62,6 +62,7 @@ {% endif %}
{{ article.subtitle }}
{{ article.text|markdown }}
+
{{ article.author_bio|markdown }}
{% endfor %} diff --git a/itf/templates/noel/insidepage.html b/itf/templates/noel/insidepage.html index 8b32970..375f7a5 100755 --- a/itf/templates/noel/insidepage.html +++ b/itf/templates/noel/insidepage.html @@ -1,6 +1,6 @@ {% extends 'noel/base.html' %} -{% block title %} ITF: Best Practices {% endblock %} +{% block title %} ITF: {{ title }} {% endblock %} {% block extra_head %} @@ -35,19 +35,18 @@