added pages app

This commit is contained in:
Sanj 2011-12-27 18:35:42 +05:30
parent c08158b56c
commit 2ebcf6cf58
10 changed files with 61 additions and 8 deletions

View File

@ -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)

0
itf/pages/__init__.py Normal file
View File

12
itf/pages/admin.py Executable file
View File

@ -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)

12
itf/pages/models.py Normal file
View File

@ -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.

16
itf/pages/tests.py Normal file
View File

@ -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)

9
itf/pages/views.py Normal file
View File

@ -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)

View File

@ -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',

View File

@ -62,6 +62,7 @@
{% endif %}
<div class="articleCaption">{{ article.subtitle }}</div><!-- ARTICLE CAPTION CLOSING -->
<div class="articleText">{{ article.text|markdown }}</div>
<div class="authorBio">{{ article.author_bio|markdown }}</div>
{% endfor %}
</div><!-- ARTICLE EMAILER CLOSING -->

View File

@ -1,6 +1,6 @@
{% extends 'noel/base.html' %}
{% block title %} ITF: Best Practices {% endblock %}
{% block title %} ITF: {{ title }} {% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="/static/css/noel/inner.css" type="text/css" />
@ -35,19 +35,18 @@
<div id="moduleAbout" class="hidden">
<div class="lightboxStyling">
<h1>Dummy lightbox heading</h1>
<h2>Dummy sub-title</h2>
<h1>{{ title }}</h1>
<!-- <h2>Dummy sub-title</h2> -->
<p>Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. Some text here. </p>
<p>Some text here</p>
<p> {{ about|linebreaksbr }} </p>
<!--
<div class="lightboxImg">
<img src="/static/images/noel/events-tab.jpg" width="230" height="233" alt="close" />
<p class="imgCaptionLightbox">Some Image Caption here</p>
</div>
<p>Some text here</p>
-->
</div>
<!--{{ about|linebreaksbr }}-->
</div>
<div id="moduleAdd" class="hidden">

View File

@ -18,6 +18,7 @@ urlpatterns = patterns('',
#(r'^search/', include('solango.urls')),
(r'^t/$', "frontpage.views.index"),
(r'm/', include('insidepages.urls')),
(r'^page/(?P<slug>[a-zA-Z].*?)/', 'pages.views.render_page'),
(r'^contact/$', 'frontpage.views.contact'),
(r'^emailer/issue/(?P<issue_no>\d+)/$', 'emailer.views.show_emailer'),
# ('m/(?P<module_slug>.*)', 'insidepages.views.main'),