added erang_organised
This commit is contained in:
parent
c1fd9151d1
commit
81606986e8
0
itf/erang_organised/__init__.py
Normal file
0
itf/erang_organised/__init__.py
Normal file
13
itf/erang_organised/admin.py
Normal file
13
itf/erang_organised/admin.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from models import *
|
||||||
|
# from forms import ArticleForm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class IssueAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'date',)
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Issue, IssueAdmin)
|
||||||
|
|
||||||
|
|
10
itf/erang_organised/models.py
Normal file
10
itf/erang_organised/models.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Issue(models.Model):
|
||||||
|
title = models.CharField(max_length=255)
|
||||||
|
date = models.DateField()
|
||||||
|
html = models.TextField(blank=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Create your models here.
|
23
itf/erang_organised/tests.py
Normal file
23
itf/erang_organised/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
|
||||||
|
"""}
|
||||||
|
|
11
itf/erang_organised/urls.py
Normal file
11
itf/erang_organised/urls.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from django.conf.urls.defaults import *
|
||||||
|
import views
|
||||||
|
|
||||||
|
urlpatterns = patterns('',
|
||||||
|
# Example:
|
||||||
|
# (r'^bhangar/', include('bhangar.foo.urls')),
|
||||||
|
#(r'^search/', include('solango.urls')),
|
||||||
|
(r'^$', views.home),
|
||||||
|
(r'^subscribe/$', views.subscribe),
|
||||||
|
(r'^postfeedback/$', views.postfeedback)
|
||||||
|
)
|
43
itf/erang_organised/views.py
Normal file
43
itf/erang_organised/views.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Create your views here.
|
||||||
|
from django.shortcuts import render_to_response
|
||||||
|
from models import Issue
|
||||||
|
from settings import ERANG_SUBSCRIBE_URL
|
||||||
|
import urllib2
|
||||||
|
from django.http import HttpResponse
|
||||||
|
from django.core.mail import send_mail
|
||||||
|
|
||||||
|
def home(request):
|
||||||
|
all_issues = Issue.objects.all().order_by('-date')
|
||||||
|
if request.GET.has_key('issue_id'):
|
||||||
|
issue_id = request.GET.get('issue_id')
|
||||||
|
else:
|
||||||
|
issue_id = all_issues[0].id
|
||||||
|
current_issue = Issue.objects.get(pk=issue_id)
|
||||||
|
other_issues = all_issues.exclude(pk=issue_id)
|
||||||
|
return render_to_response("erang/home.html", {
|
||||||
|
'current_issue': current_issue,
|
||||||
|
'past_issues': other_issues
|
||||||
|
})
|
||||||
|
|
||||||
|
def subscribe(request):
|
||||||
|
email = request.POST.get("email")
|
||||||
|
url = ERANG_SUBSCRIBE_URL + email
|
||||||
|
re = urllib2.urlopen(url).read()
|
||||||
|
return HttpResponse(re)
|
||||||
|
|
||||||
|
|
||||||
|
def postfeedback(request):
|
||||||
|
p = request.POST
|
||||||
|
issue = p.get("issue")
|
||||||
|
name = p.get("name")
|
||||||
|
email = p.get("email")
|
||||||
|
comment = p.get("feedback")
|
||||||
|
txt = """
|
||||||
|
Feedback on Issue: %s
|
||||||
|
|
||||||
|
Name: %s
|
||||||
|
Email: %s
|
||||||
|
Feedback %s
|
||||||
|
""" % (issue, name, email, comment,)
|
||||||
|
send_mail("eRang Feedback", txt, "do-not-reply@theatreforum.in", ['sanjaybhangar@gmail.com'])
|
||||||
|
return HttpResponse("1")
|
|
@ -116,7 +116,7 @@ INSTALLED_APPS = (
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'itfcore',
|
'itfcore',
|
||||||
'festival',
|
'festival',
|
||||||
'erang',
|
'erang_organised',
|
||||||
# 'solango',
|
# 'solango',
|
||||||
'multilingual',
|
'multilingual',
|
||||||
# 'multilingual.flatpages',
|
# 'multilingual.flatpages',
|
||||||
|
|
135
itf/templates/erang/home.html
Normal file
135
itf/templates/erang/home.html
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<title>{{ current_issue.title }}</title>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#subscribeForm').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var email = $('#email').val();
|
||||||
|
$('#subscribeBtn').attr("disabled", "disabled").text("Subscribing...");
|
||||||
|
$.post("/erang/subscribe/", {
|
||||||
|
'email': email
|
||||||
|
}, function(response) {
|
||||||
|
$('#subscribe').slideUp("slow", function() {
|
||||||
|
$(this).addClass("response").html("<b>" + email + "</b>" + " has been subscribed to eRang. Thanks!");
|
||||||
|
$(this).slideDown("slow");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#commentForm').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('#commentSubmit').attr("disabled", "disabled").text("Submitting...");
|
||||||
|
$.post("/erang/postfeedback/", {
|
||||||
|
'name': $('#commentName').val(),
|
||||||
|
'email': $('#commentEmail').val(),
|
||||||
|
'comment': $('#commentComment').val(),
|
||||||
|
'issue': document.title
|
||||||
|
}, function(response) {
|
||||||
|
$('#commentWrapper').slideUp("slow", function() {
|
||||||
|
$(this).addClass("response").html("Your feedback has been emailed to us at erang" + "@" + "theatreforum.in. Thanks!");
|
||||||
|
$(this).slideDown("slow", function() {
|
||||||
|
$(document).scrollTop($(document).height());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#leftMenu {
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
margin-top: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapper {
|
||||||
|
width: 1000px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newsletterContent {
|
||||||
|
width: 780px;
|
||||||
|
float: left;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#commentTable {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
text-align: right;
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#commentComment {
|
||||||
|
width: 400px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newsletterList a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.response {
|
||||||
|
font-size: 11px;
|
||||||
|
text-align: center;
|
||||||
|
color: #363636;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div id="leftMenu">
|
||||||
|
<h3>Past Issues:</h3>
|
||||||
|
<ul class="newsletterList">
|
||||||
|
{% for p in past_issues %}
|
||||||
|
<a href="?issue_id={{p.id}}">{{ p.title }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
<div id="subscribe">
|
||||||
|
<h3>Subscribe:</h3>
|
||||||
|
<form id="subscribeForm">
|
||||||
|
<input id="email" name="email" data-placeholder="E-Mail" /><br />
|
||||||
|
<button id="subscribeBtn">Subscribe!</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="newsletterContent">
|
||||||
|
{% autoescape off %}
|
||||||
|
{{ current_issue.html }}
|
||||||
|
{% endautoescape %}
|
||||||
|
<div id="commentWrapper">
|
||||||
|
<a name="comments"></a>
|
||||||
|
<form id="commentForm" action="">
|
||||||
|
<table id="commentTable">
|
||||||
|
<tr>
|
||||||
|
<td class="label">Name:</td>
|
||||||
|
<td><input name="commentName" id="commentName" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label">Email:</td>
|
||||||
|
<td><input name="commentEmail" id="commentEmail" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label">Feedback:</td>
|
||||||
|
<td><textarea name="commentComment" id="commentComment"></textarea></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="label"></td>
|
||||||
|
<td><button id="commentSubmit">Submit</button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user