author | amit |
Fri, 15 Oct 2010 15:59:28 +0530 | |
changeset 2 | f5e18f8ed036 |
parent 0 | 54f784230511 |
child 3 | de4a2ed2f34b |
permissions | -rw-r--r-- |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
1 |
# Create your views here. |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
2 |
from django.http import HttpResponse |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
3 |
from django.utils.simplejson import dumps |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
4 |
from django.contrib.csrf.middleware import csrf_exempt |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
5 |
import django.forms as forms |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
6 |
from django.db import connection |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
7 |
from django.http import HttpResponse,Http404 |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
8 |
from sphinxcomment.models import Comment, Element |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
9 |
from django.shortcuts import get_object_or_404, render_to_response |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
10 |
from django.template import Context |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
11 |
from django.template.loader import get_template |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
12 |
from django.utils.simplejson import dumps |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
13 |
|
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
14 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
15 |
placeholder_string = open('paragraph_id.py').read() |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
16 |
exec placeholder_string |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
17 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
18 |
def dump_queries(): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
19 |
# requires settings.DEBUG to be set to True in order to work |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
20 |
if len(connection.queries) == 1: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
21 |
print connection.queries |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
22 |
else: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
23 |
qs = {} |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
24 |
for q in connection.queries: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
25 |
qs[q['sql']] = qs.setdefault(q['sql'], 0) + 1 |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
26 |
for q in sorted(qs.items(), key=lambda x: x[1], reverse=True): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
27 |
print q |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
28 |
print len(connection.queries) |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
29 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
30 |
class CommentForm(forms.Form): |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
31 |
name = forms.CharField(max_length=64) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
32 |
url = forms.URLField(max_length=128, required=False) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
33 |
comment = forms.CharField(widget=forms.Textarea(attrs={ |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
34 |
'rows': 8, 'cols': 60 |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
35 |
})) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
36 |
remember = forms.BooleanField(initial=True, required=False) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
37 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
38 |
def comments_by_chapter(chapter): |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
39 |
objs = {} |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
40 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
41 |
try: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
42 |
para_list=p_list[chapter] |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
43 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
44 |
for paragraph_id in para_list: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
45 |
objs[paragraph_id]=[] |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
46 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
47 |
except: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
48 |
para_list=[] |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
49 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
50 |
for paragraph_id in para_list: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
51 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
52 |
for c in Comment.objects.filter(element__chapter_name=chapter,element__paragraph_id=paragraph_id).order_by('date'): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
53 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
54 |
objs[paragraph_id].append(c) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
55 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
56 |
return objs |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
57 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
58 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
59 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
60 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
61 |
|
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
62 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
63 |
def chapter(request): |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
64 |
template = get_template('comment.html') |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
65 |
resp = {} |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
66 |
for elt, comments in comments_by_chapter(chapter).iteritems(): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
67 |
print elt ,comments |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
68 |
form = CommentForm(initial={ |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
69 |
'paragraph_id': elt, |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
70 |
'name': name |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
71 |
}) |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
72 |
resp[elt] = template.render(Context({ |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
73 |
'paragraph_id': elt, |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
74 |
'form': form, |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
75 |
'length': len(comments), |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
76 |
'query': comments, |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
77 |
})) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
78 |
return HttpResponse(dumps(resp), mimetype='application/json') |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
79 |
|
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
80 |
def chapter_count(request,chapter_name): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
81 |
print chapter_name |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
82 |
chapter_name=chapter_name.split('.')[0] |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
83 |
comment_objs = comments_by_chapter(chapter_name) |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
84 |
resp={} |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
85 |
temp_dict={} |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
86 |
for elt, comments in comment_objs.iteritems(): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
87 |
temp_dict[elt]=len(comments) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
88 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
89 |
resp['count']=temp_dict |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
90 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
91 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
92 |
print resp |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
93 |
return HttpResponse(dumps(resp), mimetype='application/json') |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
94 |
|
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
95 |
def single(request,paragraph_id, form=None, newid=None): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
96 |
paragraph_id=paragraph_id[:-1] |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
97 |
queryset = Comment.objects.filter(element=paragraph_id) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
98 |
print paragraph_id |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
99 |
if form is None: |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
100 |
form = CommentForm(initial={ |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
101 |
'paragraph_id': paragraph_id, |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
102 |
'name': request.session.get('name', ''), |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
103 |
}) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
104 |
try: |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
105 |
error = form.errors[0] |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
106 |
except: |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
107 |
error = '' |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
108 |
print form.errors |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
109 |
return render_to_response('comment.html', { |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
110 |
'paragraph_id': paragraph_id, |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
111 |
'form': form, |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
112 |
'length': len(queryset), |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
113 |
'query': queryset, |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
114 |
'newid': newid or True, |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
115 |
'error': error, |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
116 |
}) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
117 |
|
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
118 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
119 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
120 |
|
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
121 |
def submit(request, paragraph_id): |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
122 |
try: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
123 |
element = get_object_or_404(Element, paragraph_id=paragraph_id) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
124 |
except Http404: |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
125 |
chapter_id='_'.join(paragraph_id.split('_')[0:-1]) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
126 |
chapter_name=chapter_id.replace('_','/') |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
127 |
element=Element(chapter_name=chapter_name,paragraph_id=paragraph_id) |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
128 |
element.save() |
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
129 |
print element.chapter_name |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
130 |
form = None |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
131 |
newid = None |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
132 |
|
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
133 |
if request.method == 'POST': |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
134 |
form = CommentForm(request.POST) |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
135 |
print form.errors |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
136 |
if form.is_valid(): |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
137 |
print form.cleaned_data |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
138 |
data = form.cleaned_data |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
139 |
if data.get('remember'): |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
140 |
request.session['name'] = data['name'] |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
141 |
request.session['url'] = data['url'] |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
142 |
else: |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
143 |
request.session.pop('name', None) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
144 |
request.session.pop('url', None) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
145 |
c = Comment(element=element, |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
146 |
comment=data['comment'], |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
147 |
submitter_name=data['name'], |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
148 |
submitter_url=data['url'], |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
149 |
ip=request.META.get('REMOTE_ADDR')) |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
150 |
print c |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
151 |
c.save() |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
152 |
|
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
153 |
form = None |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
154 |
return single(request, paragraph_id, form,) |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
155 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
156 |
def test(request): |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
157 |
print request |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
158 |
string="<p>test comment</p>" |
2
f5e18f8ed036
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
amit
parents:
0
diff
changeset
|
159 |
return HttpResponse(string,mimetype="text/plain") |
0
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
160 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
161 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
162 |
|
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
163 |
#return HttpResponse(dumps(string),mimetype="text/plain") |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
164 |
#test= csrf_exempt(test) |
54f784230511
Initial commit of django based commenting system for sphinx. Already has
amit
parents:
diff
changeset
|
165 |