erang comments csrf issue solved + some css

This commit is contained in:
Sanj 2012-01-12 23:55:59 +05:30
parent bc7bc46912
commit b9a1d1ec89
4 changed files with 66 additions and 11 deletions

View File

@ -9,6 +9,7 @@ from django.contrib.contenttypes.models import ContentType
from insidepages.models import ModuleTab, ModelExtra
from os.path import exists
from sorl.thumbnail import get_thumbnail
from django.template import RequestContext
def splitSearch(string):
ret = []
@ -123,9 +124,10 @@ class ItfModel(models.Model):
def get_dict(self):
return self.get(self._get_fields().keys())
def insidepage_dict(self):
def insidepage_dict(self, request):
context = RequestContext(request, self.info_dict())
try:
html = render_to_string(self.get_template_path(), self.info_dict())
html = render_to_string(self.get_template_path(), context)
except:
html = "Template path not found at : " + self.get_template_path()
return {

View File

@ -68,11 +68,15 @@ def get_list(request):
def get_details(request):
# import pdb
tab_slug = request.GET.get("tab", '')
tab = get_object_or_404(ModuleTab, slug=tab_slug)
model_class = tab.model_class()
object_id = request.GET.get("object_id", 0)
obj = get_object_or_404(model_class, pk=object_id)
return render_to_json_response(obj.insidepage_dict())
ret = obj.insidepage_dict(request)
# ret['csrf_token'] = c
# pdb.set_trace()
return render_to_json_response(ret)

View File

@ -55,6 +55,36 @@
float:left;
}
#subscribeForm {
display:none;
float:right;
}
#subscribeBtn {
background-color: #F7BD00;
color: white;
font-size: 14px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
padding: 2px 8px;
border: 1px solid transparent;
font-family: 'Century Gothic', Arial, 'DejaVu Sans', sans-serif;
cursor: pointer;
}
#subscribeInput {
border: 1px solid #E3E3E3;
padding: 2px 2px 3px 4px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: inset 2px 2px 6px #d7d7d7;
-webkit-box-shadow: inset 2px 2px 6px #d7d7d7;
box-shadow: inset 2px 2px 6px #d7d7d7;
margin-bottom: 10px;
}
#navEmailer {
font-family:"Century Gothic", Arial, Helvetica, sans-serif;
float:right;
@ -186,7 +216,7 @@ padding:14px 14px 18px 14px;
}
.contentLinks p {
padding:8px 12px;
padding:0px 12px;
}
.contentLinks h2 {
@ -196,6 +226,19 @@ padding:14px 14px 18px 14px;
line-height:20px;
}
/* COMMENtS */
.comment {
margin-bottom:10px;
}
.comment_user {
font-weight:bold;
color:#f7bd00;
}
/* COMMENtS */
/* CONTENT EMAILER CLOSING */
/* ------------------------------- */

View File

@ -20,8 +20,13 @@
<!--<li><a href="">Bulletin Board |</a></li>
<li><a href="">Links</a></li>-->
</ul><!--NAV EMAILER CLOSING -->
<div class="clear"></div>
<div class="clear"></div>
<div id="subscribeForm">
<input id="subscribeInput" />
<button id="subscribeBtn">Subscribe</button>
</div>
<div class="clear"></div>
</div><!-- HEADER EMAILER CLOSING -->
@ -71,7 +76,7 @@
<a name="weblinks"></a><h1>WEB LINKS</h1>
{% for weblink in weblinks %}
<h2><a href="{{weblink.url}}" target="_blank">{{ weblink.title }}</a></h2>
<p>{{ weblink.text|markdown }}</p>
{{ weblink.text|markdown }}
{% endfor %}
</div><!-- WEB LINKS CLOSING -->
@ -79,7 +84,7 @@
<a name="bbitems"></a><h1>BULLETIN BOARD</h1>
{% for bbitem in bbitems %}
<h2>{{ bbitem.title }}</h2>
<p>{{ bbitem.text|markdown }}</p>
{{ bbitem.text|markdown }}
{% endfor %}
</div><!-- WEB LINKS CLOSING -->
@ -102,7 +107,7 @@ association of theatre people coming together in the larger interests of theatre
</div><!-- FOOTER EMAILER CLOSING -->
<!--
<div id="commentWrapper">
{% load comments %}
<h3>Comments and Feedback</h3>
@ -131,7 +136,8 @@ association of theatre people coming together in the larger interests of theatre
<h4 class="formHeader">
Leave a Response:
</h4>
<form action="{% comment_form_target %}" method="POST">{% csrf_token %}
<form action="{% comment_form_target %}" method="POST">
{% csrf_token %}
<input type="hidden" name="next" value="{{ issue.get_absolute_url }}" />
<table id="form_table">
<tr class="leave_response">
@ -149,7 +155,7 @@ association of theatre people coming together in the larger interests of theatre
</form>
</div>
</div>
-->
</div>