front page admin + slider
This commit is contained in:
parent
6498ac90f7
commit
cb96e0a20f
0
itf/frontpage/__init__.py
Normal file
0
itf/frontpage/__init__.py
Normal file
21
itf/frontpage/admin.py
Normal file
21
itf/frontpage/admin.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from models import *
|
||||||
|
# from forms import ArticleForm
|
||||||
|
|
||||||
|
class MenuItemInline(admin.StackedInline):
|
||||||
|
model = MenuItem
|
||||||
|
extra = 7
|
||||||
|
|
||||||
|
class SliderBoxAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'order',)
|
||||||
|
list_editable = ['order']
|
||||||
|
# list_display = ('title', 'date',)
|
||||||
|
|
||||||
|
class MenuHeadingAdmin(admin.ModelAdmin):
|
||||||
|
inlines = [MenuItemInline]
|
||||||
|
list_display = ('name', 'order',)
|
||||||
|
list_editable = ['order']
|
||||||
|
|
||||||
|
admin.site.register(MenuHeading, MenuHeadingAdmin)
|
||||||
|
admin.site.register(SliderBox, SliderBoxAdmin)
|
||||||
|
|
44
itf/frontpage/models.py
Normal file
44
itf/frontpage/models.py
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class SliderBox(models.Model):
|
||||||
|
title = models.CharField(max_length=64)
|
||||||
|
image = models.ImageField(upload_to='upload/sliderImages/')
|
||||||
|
boldText = models.CharField(max_length=256, blank=True)
|
||||||
|
normalText = models.CharField(max_length=256, blank=True)
|
||||||
|
url = models.CharField(max_length=128, blank=True)
|
||||||
|
order = models.IntegerField(default=1)
|
||||||
|
imageTop = models.IntegerField(default=0)
|
||||||
|
is_displayed = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order', 'id']
|
||||||
|
|
||||||
|
|
||||||
|
class MenuHeading(models.Model):
|
||||||
|
name = models.CharField(max_length=64)
|
||||||
|
order = models.IntegerField(default=1)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order', 'id']
|
||||||
|
|
||||||
|
|
||||||
|
class MenuItem(models.Model):
|
||||||
|
name = models.CharField(max_length=64)
|
||||||
|
url = models.CharField(max_length=256)
|
||||||
|
menu = models.ForeignKey(MenuHeading)
|
||||||
|
order = models.IntegerField(default=1)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order', 'id']
|
||||||
|
|
||||||
|
|
||||||
|
# Create your models here.
|
23
itf/frontpage/tests.py
Normal file
23
itf/frontpage/tests.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
"""
|
||||||
|
This file demonstrates two different styles of tests (one doctest and one
|
||||||
|
unittest). These will both pass when you run "manage.py test".
|
||||||
|
|
||||||
|
Replace these 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.failUnlessEqual(1 + 1, 2)
|
||||||
|
|
||||||
|
__test__ = {"doctest": """
|
||||||
|
Another way to test that 1 + 1 is equal to 2.
|
||||||
|
|
||||||
|
>>> 1 + 1 == 2
|
||||||
|
True
|
||||||
|
"""}
|
||||||
|
|
27
itf/frontpage/views.py
Normal file
27
itf/frontpage/views.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Create your views here.
|
||||||
|
from django.shortcuts import render_to_response
|
||||||
|
from models import *
|
||||||
|
from settings import TWITTER_ID
|
||||||
|
import twitter
|
||||||
|
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
tApi = twitter.Api()
|
||||||
|
statuses = tApi.GetUserTimeline(TWITTER_ID)
|
||||||
|
boxes = SliderBox.objects.all()
|
||||||
|
menuHeads = MenuHeading.objects.all()
|
||||||
|
menus = []
|
||||||
|
for m in menuHeads:
|
||||||
|
d = {
|
||||||
|
'name': m.name,
|
||||||
|
'items': [{'name': item.name, 'url': item.url} for item in m.menuitem_set.all()]
|
||||||
|
}
|
||||||
|
menus.append(d)
|
||||||
|
return render_to_response("noel/index.html", {
|
||||||
|
'tweets': statuses[0:5],
|
||||||
|
'boxes': boxes,
|
||||||
|
'menus': menus
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ DATABASE_PASSWORD = '' # Not used with sqlite3.
|
||||||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
|
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
|
||||||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
|
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
|
||||||
|
|
||||||
|
TWITTER_ID = "sachin_rt"
|
||||||
|
|
||||||
CACHES = {
|
CACHES = {
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||||
|
@ -142,6 +144,7 @@ INSTALLED_APPS = (
|
||||||
'app',
|
'app',
|
||||||
'api',
|
'api',
|
||||||
'boxes',
|
'boxes',
|
||||||
|
'frontpage',
|
||||||
# 'solango',
|
# 'solango',
|
||||||
'multilingual',
|
'multilingual',
|
||||||
# 'multilingual.flatpages',
|
# 'multilingual.flatpages',
|
||||||
|
|
|
@ -74,6 +74,7 @@ opacity:0.6;}
|
||||||
height:282px;
|
height:282px;
|
||||||
background-color:#FFF;
|
background-color:#FFF;
|
||||||
position:relative;
|
position:relative;
|
||||||
|
background-repeat: no-repeat;
|
||||||
-moz-border-radius:8px;
|
-moz-border-radius:8px;
|
||||||
-webkit-border-radius:8px;
|
-webkit-border-radius:8px;
|
||||||
border-radius:8px;
|
border-radius:8px;
|
||||||
|
@ -171,7 +172,7 @@ clear:both;
|
||||||
margin-left:auto;
|
margin-left:auto;
|
||||||
margin-right:auto;
|
margin-right:auto;
|
||||||
padding-top:37px;
|
padding-top:37px;
|
||||||
overflow-y:hidden;
|
overflow:hidden;
|
||||||
clear:both;
|
clear:both;
|
||||||
position:relative;}
|
position:relative;}
|
||||||
|
|
||||||
|
@ -189,7 +190,10 @@ right:10px;}
|
||||||
|
|
||||||
|
|
||||||
#sliderTabs /*at 800 res, we have different probs in different browsers with the tabs, ok to give position absolute to the ul?*/
|
#sliderTabs /*at 800 res, we have different probs in different browsers with the tabs, ok to give position absolute to the ul?*/
|
||||||
{width:4000px;}
|
{width:4000px;
|
||||||
|
position:absolute;
|
||||||
|
left:0px;
|
||||||
|
}
|
||||||
|
|
||||||
ul#sliderTabs li
|
ul#sliderTabs li
|
||||||
{float:left;}
|
{float:left;}
|
||||||
|
|
|
@ -22,6 +22,16 @@
|
||||||
<a href=""><img src="/static/images/noel/home.png" width="16" height="17" alt="home" id="homeIcon"></a>
|
<a href=""><img src="/static/images/noel/home.png" width="16" height="17" alt="home" id="homeIcon"></a>
|
||||||
|
|
||||||
<ul id="navMenu">
|
<ul id="navMenu">
|
||||||
|
{% for m in menus %}
|
||||||
|
<li><a href="">{{ m.name }}</a>
|
||||||
|
<ul>
|
||||||
|
{% for i in m.items %}
|
||||||
|
<li><a href="{{ i.url }}">{{ i.name }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
<!--
|
||||||
<li><a href="">Resources</a>
|
<li><a href="">Resources</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="">Script Archive</a></li>
|
<li><a href="">Script Archive</a></li>
|
||||||
|
@ -56,6 +66,7 @@
|
||||||
<li><a href="">Contribute to eRang</a></li>
|
<li><a href="">Contribute to eRang</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
-->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="loginMenu">
|
<ul id="loginMenu">
|
||||||
|
@ -69,6 +80,17 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
|
||||||
|
{% for m in menus %}
|
||||||
|
<ul class="footerList">
|
||||||
|
<a href="">{{ m.name }}</a>
|
||||||
|
{% for i in m.items %}
|
||||||
|
<li><a href="{{ i.url }}">- {{ i.name }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<!--
|
||||||
<ul id="resources" class="footerList">
|
<ul id="resources" class="footerList">
|
||||||
<a href="">Resources</a>
|
<a href="">Resources</a>
|
||||||
<li><a href="">- Script Archive</a></li>
|
<li><a href="">- Script Archive</a></li>
|
||||||
|
@ -102,7 +124,7 @@
|
||||||
<li><a href="">- volunteer</a></li>
|
<li><a href="">- volunteer</a></li>
|
||||||
<li><a href="">- contribute to eRang</a></li>
|
<li><a href="">- contribute to eRang</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
-->
|
||||||
<p id="copyright">© 2011 India Theatre Forum. All Rights Reserved.</p>
|
<p id="copyright">© 2011 India Theatre Forum. All Rights Reserved.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<link rel="stylesheet" type="text/css" href="/static/css/noel/home.css" />
|
<link rel="stylesheet" type="text/css" href="/static/css/noel/home.css" />
|
||||||
|
<script type="text/javascript" src="/static/js/frontpage.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -37,11 +37,16 @@
|
||||||
|
|
||||||
<div id="contentTab">
|
<div id="contentTab">
|
||||||
<ul>
|
<ul>
|
||||||
|
{% for t in tweets %}
|
||||||
|
<li>{{ t.text }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
<!--
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
<li>@dootah there's a new play this weekend. <span>bit.ly/xYr3dD</span></li>
|
||||||
|
-->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -60,6 +65,17 @@
|
||||||
<img src="/static/images/noel/arrow-left.png" width="28" height="42" alt="arrow-left" id="arrowLeft">
|
<img src="/static/images/noel/arrow-left.png" width="28" height="42" alt="arrow-left" id="arrowLeft">
|
||||||
<img src="/static/images/noel/arrow-right.png" width="28" height="42" alt="arrow-right" id="arrowRight">
|
<img src="/static/images/noel/arrow-right.png" width="28" height="42" alt="arrow-right" id="arrowRight">
|
||||||
<ul id="sliderTabs">
|
<ul id="sliderTabs">
|
||||||
|
{% for b in boxes %}
|
||||||
|
<li class="tab" style="background-image:url('{{b.image.url}}');background-position:0px {{b.imageTop}}px;">
|
||||||
|
<h4 class="tabHeader">{{ b.title }}</h4>
|
||||||
|
<div class="textTab">
|
||||||
|
<p><span class="boldText">{{ b.boldText }}</span> {{ b.normalText }}</p>
|
||||||
|
</div>
|
||||||
|
<a href="{{ b.url }}" class="buttonTab"> Learn more </a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
<!--
|
||||||
<li id="scriptArchive" class="tab">
|
<li id="scriptArchive" class="tab">
|
||||||
<h3 class="tabHeader"> SCRIPT <span>ARCHIVE</span> </h3>
|
<h3 class="tabHeader"> SCRIPT <span>ARCHIVE</span> </h3>
|
||||||
<div class="textTab">
|
<div class="textTab">
|
||||||
|
@ -108,6 +124,7 @@
|
||||||
<p><span>Unsure about a situation?</span> Need to know the best way to proceed? Here are some stories & guidelines to help you.</p>
|
<p><span>Unsure about a situation?</span> Need to know the best way to proceed? Here are some stories & guidelines to help you.</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="" class="buttonTab"> Learn more </a> </li>
|
<a href="" class="buttonTab"> Learn more </a> </li>
|
||||||
|
-->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ urlpatterns = patterns('',
|
||||||
# Example:
|
# Example:
|
||||||
# (r'^bhangar/', include('bhangar.foo.urls')),
|
# (r'^bhangar/', include('bhangar.foo.urls')),
|
||||||
#(r'^search/', include('solango.urls')),
|
#(r'^search/', include('solango.urls')),
|
||||||
|
(r'^t/$', "frontpage.views.index"),
|
||||||
(r'^comments/', include('django.contrib.comments.urls')),
|
(r'^comments/', include('django.contrib.comments.urls')),
|
||||||
(r'^ckeditor/', include('ckeditor.urls')),
|
(r'^ckeditor/', include('ckeditor.urls')),
|
||||||
(r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
|
(r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user