Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
authoramit
Fri, 15 Oct 2010 15:59:28 +0530
changeset 2 f5e18f8ed036
parent 1 5574cfc2b28d
child 3 de4a2ed2f34b
Changes to account for a new way of keeping ids ... Uses the whole path rather than just file name
hsbook_back.js
sphinx_django/settings.py
sphinx_django/settings.pyc
sphinx_django/settings.py~
sphinx_django/sphinxcomment/models.py
sphinx_django/sphinxcomment/models.pyc
sphinx_django/sphinxcomment/models.py~
sphinx_django/sphinxcomment/views.py
sphinx_django/sphinxcomment/views.pyc
sphinx_django/sphinxcomment/views.py~
sphinx_django/templates/comment.html
sphinx_django/test.db
sphinx_django/urls.py
sphinx_django/urls.pyc
sphinx_django/urls.py~
--- a/hsbook_back.js	Thu Sep 30 15:59:32 2010 +0530
+++ b/hsbook_back.js	Fri Oct 15 15:59:28 2010 +0530
@@ -3,43 +3,52 @@
 }
 
 function beforeComment(formData, jqForm, options) {
-  var form = jqForm[0];
-  if (!form.comment.value) {
-    $(options.target + " span.comment_error").empty().append(
-      "<span class=\"comment_error\">Your comment is empty</span>");
+  var form=jqForm[0];
+
+  if (form.comment.textLength.toString()=='0') {
+    $("span.comment_error").empty().append(
+      "<span class=\"comment_error\">  Your comment is empty</span>");
     return false;
   }
-  if (!form.name.value) {
-    $(options.target + " span.comment_error").empty().append(
-      "<span class=\"comment_error\">Please provide a name</span>");
+  if (form.name.textLength.toString()=='0') {
+    $("span.comment_error").empty().append(
+      "<span class=\"comment_error\">   Please provide a name</span>");
     return false;
   }
   $(options.target + " span.comment_error").empty().after(
     "<img src=\"/support/icons/throbber.gif\" style=\"vertical-align: middle\"/>");
-  $(options.target + " input[@name=submit]").attr("disabled", true);
+  $("input[@name=submit]").attr("disabled", true);
 }
 
 function ajaxifyForm(id) {
-  var q = qid(id);
+
+//  $('#form_func_1').replaceWith('something');
 
-  $("#form_" + q).ajaxForm({ beforeSubmit: beforeComment,
-			     success: function() { ajaxifyForm(id); },
-			     target: "#comments_" + q });
-}
+  var substring=id.substr(9);
+  $('#form_'+substring).ajaxForm({beforeSubmit: beforeComment,
+			      success: function(){ loadComments(id);}
+
+			     });}
+
 
 function toggleComment(id) {
   $("#toggle_" + qid(id)).nextAll().toggle();
   return false;
 }
 
-function loadComments(id) {
-  $("#comments_" + qid(id)).load(location.protocol + "//" + location.host +
-				 "/comments/single/" + id + "/", function() {
-    ajaxifyForm(id);
-  });
-  return false;
+
+function loadComments(id)
+{
+
+  var substring=id.substr(9);
+  $('#comments_'+substring).load("http://127.0.0.1:8000/single/"+ substring +'/',function() { ajaxifyForm(id);}
+				);
+
 }
 
+
+
+
 function loadAllComments() {
   $("a.commenttoggle").each(function() {
     var id = $(this).attr("pid");
@@ -61,20 +70,37 @@
 $("p[@id]").each(function() {
     $(this).append(loading($(this).attr("id")));
 		   });
-$("p[@id]").each(function() {
-		   var url_string=window.location.pathname;
-		   var temp = new Array();
-		   temp = url_string.split('/');
-		   var chap_name=temp[temp.length-1].split('.')[0];
+
+
+var url_string=window.location.pathname;
+var temp = new Array();
+temp = url_string.split('/');
+var chap_name=temp[temp.length-1].split('.')[0];
+
+jQuery.getJSON("http://127.0.0.1:8000/count/"+chap_name, function(data) {
 
-		   $.getJSON("http://127.0.0.1:8000/count/"+chap_name, function(data) {
-	      $.each(data , function(id) {
-		       $("span.commenttoggle").replaceWith("<a class='commenttoggle'" + "href='comments: show / hide'>" + data.count +" "+"comments" + "</a>");
- 		   });
+		 $("span.comment").each(function(data_val) {
+		 var id = $(this).attr("id");
+		var substring=id.substr(9);
+
+		$(this).replaceWith("<span class='comment'" +  ' id='+ id+ " <a   +  href=javascript:loadComments('"+id+"');>" + data.count[substring] +' comments'+ "</a>");
+
+					});
+
+
+	       });
+
+		  });
 
 
 
-	    });
-		  });
+
+
+
+
 
-		  });
+
+
+
+
+
--- a/sphinx_django/settings.py	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/settings.py	Fri Oct 15 15:59:28 2010 +0530
@@ -65,6 +65,9 @@
 
 ROOT_URLCONF = 'sphinx_django.urls'
 
+
+
+
 TEMPLATE_DIRS = (
     "/home/amit/review/sphinx_django/templates/"
     
Binary file sphinx_django/settings.pyc has changed
--- a/sphinx_django/settings.py~	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/settings.py~	Fri Oct 15 15:59:28 2010 +0530
@@ -4,7 +4,7 @@
 TEMPLATE_DEBUG = DEBUG
 
 ADMINS = (
-    # ('Your Name', 'your_email@domain.com'),
+    ('Amit Sethi', 'amit.pureenergy@gmail.com'),
 )
 
 MANAGERS = ADMINS
@@ -67,15 +67,17 @@
 
 TEMPLATE_DIRS = (
     "/home/amit/review/sphinx_django/templates/"
-
+    
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
 )
 
 INSTALLED_APPS = (
+    'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
+    'sphinx_django.sphinxcomment',
 )
--- a/sphinx_django/sphinxcomment/models.py	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/sphinxcomment/models.py	Fri Oct 15 15:59:28 2010 +0530
@@ -7,12 +7,12 @@
 mutable = True
 
 class Element(models.Model):
-    chapter_name = models.CharField('Chapter name', max_length=100, editable=False,
-                               db_index=True)
-
+    paragraph_id = models.CharField('Paragraph Id', max_length=100, editable=False, primary_key=True) 
+    chapter_name = models.CharField('Chapter name', max_length=100, editable=False,db_index=True)
+    
 
     def __unicode__(self):
-        return self.chapter_name
+        return self.paragraph_id
     
 class Comment(models.Model):
     element = models.ForeignKey(Element,
Binary file sphinx_django/sphinxcomment/models.pyc has changed
--- a/sphinx_django/sphinxcomment/models.py~	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/sphinxcomment/models.py~	Fri Oct 15 15:59:28 2010 +0530
@@ -2,19 +2,17 @@
 
 # Create your models here.
 from django.db import models
-import sha
+
 
 mutable = True
 
-class Chapter(models.Model):
-    id = models.CharField('ID attribute', max_length=64, editable=False,
-                          primary_key=True)
-    chapter = models.CharField('Chapter ID', max_length=100, editable=False,
-                               db_index=True)
-
+class Element(models.Model):
+    paragraph_id = models.CharField('Paragraph Id', max_length=100, editable=False, primary_key=True) 
+    chapter_name = models.CharField('Chapter name', max_length=100, editable=False,db_index=True)
+    
 
     def __unicode__(self):
-        return self.id
+        return self.paragraph_id
     
 class Comment(models.Model):
     element = models.ForeignKey(Element,
@@ -29,19 +27,8 @@
         help_text='IP address from which comment was submitted')
     date = models.DateTimeField('date submitted', auto_now=True,
                                 auto_now_add=True)
-    reviewed = models.BooleanField(default=False, db_index=True,
-        help_text='Has this comment been reviewed by an author?')
-    hidden = models.BooleanField(default=False, db_index=True,
-        help_text='Has this comment been hidden from public display?')
 
     def __unicode__(self):
         return self.comment[:32]
 
-    def get_absolute_url(self):
-        s = sha.new()
-        s.update(repr(self.comment))
-        s.update(repr(self.submitter_name))
-        s.update(str(self.date))
-        return '/read/%s.html#%s?comment=%s&uuid=%s' % (
-            self.element.chapter, self.element.id, self.id, s.hexdigest()[:20]
-            )
+    
--- a/sphinx_django/sphinxcomment/views.py	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/sphinxcomment/views.py	Fri Oct 15 15:59:28 2010 +0530
@@ -4,13 +4,17 @@
 from django.contrib.csrf.middleware import csrf_exempt
 import django.forms as forms
 from django.db import connection
-from django.http import HttpResponse
+from django.http import HttpResponse,Http404
 from sphinxcomment.models import Comment, Element
 from django.shortcuts import get_object_or_404, render_to_response
 from django.template import Context
 from django.template.loader import get_template
 from django.utils.simplejson import dumps 
 
+
+placeholder_string = open('paragraph_id.py').read()
+exec placeholder_string
+
 def dump_queries():
     # requires settings.DEBUG to be set to True in order to work
     if len(connection.queries) == 1:
@@ -24,7 +28,6 @@
         print len(connection.queries)
 
 class CommentForm(forms.Form):
-    id = forms.CharField(widget=forms.HiddenInput)
     name = forms.CharField(max_length=64)
     url = forms.URLField(max_length=128, required=False)
     comment = forms.CharField(widget=forms.Textarea(attrs={
@@ -33,48 +36,81 @@
     remember = forms.BooleanField(initial=True, required=False)
 
 def comments_by_chapter(chapter):
-    objs = []
-    for c in Comment.objects.filter(element__chapter_name=chapter).order_by('date'):
-        objs.append(c)
-    return objs
+     objs = {}
+
+     try:
+         para_list=p_list[chapter]
+
+         for paragraph_id in para_list:
+           objs[paragraph_id]=[] 
+
+     except:
+         para_list=[]
+
+     for paragraph_id in para_list:
+         print chapter ,paragraph_id
+         for c in Comment.objects.filter(element__chapter_name=chapter,element__paragraph_id=paragraph_id).order_by('date'):
+
+             objs[paragraph_id].append(c)
+
+             
+     
+     return objs
+
+     
+
+
+
 
 def chapter(request):
-#    template = get_template('comment.html')
-#    resp = {}
-    # for elt, comments in comments_by_chapter(id).iteritems():
-    form = CommentForm(initial={
-            'id': 'elt',
-            'name': 'name'
+    template = get_template('comment.html')
+    resp = {}
+    for elt, comments in comments_by_chapter(chapter).iteritems():
+        print elt ,comments
+        form = CommentForm(initial={
+            'paragraph_id': elt,
+            'name': name
             })
-    resp['elt'] = template.render(Context({
-            'id': 'elt',
+        resp[elt] = template.render(Context({
+            'paragraph_id': elt,
             'form': form,
-            'length': 5,
-            'query': 'abcde',
+            'length': len(comments),
+            'query': comments,
             }))
     return HttpResponse(dumps(resp), mimetype='application/json')
 
 def chapter_count(request,chapter_name):
-    comment_count = comments_by_chapter(chapter_name)
+    print chapter_name
+    chapter_name=chapter_name.split('.')[0]
+    comment_objs = comments_by_chapter(chapter_name)
     resp={}
-    resp['count']=len(comment_count)
+    temp_dict={}
+    for elt, comments in comment_objs.iteritems():
+        temp_dict[elt]=len(comments)
 
-
+    resp['count']=temp_dict
+      
+    
+    print resp
     return HttpResponse(dumps(resp), mimetype='application/json')
     
-def single(request, id, form=None, newid=None):
-    queryset = Comment.objects.filter(element=id, hidden=False).order_by('date')
+def single(request,paragraph_id, form=None, newid=None):
+    if paragraph_id[-1]=='/':
+        paragraph_id=paragraph_id[:-1]
+    queryset = Comment.objects.filter(element=paragraph_id)
+    print paragraph_id 
     if form is None:
         form = CommentForm(initial={
-            'id': id,
+            'paragraph_id': paragraph_id,
             'name': request.session.get('name', ''),
             })
     try:
         error = form.errors[0]
     except:
         error = ''
+    print form.errors
     return render_to_response('comment.html', {
-        'id': id,
+        'paragraph_id': paragraph_id,
         'form': form,
         'length': len(queryset),
         'query': queryset,
@@ -82,13 +118,28 @@
         'error': error,
         })
 
-def submit(request, id):
-    element = get_object_or_404(Element, id=id)
+
+
+
+def submit(request, paragraph_id):
+
+    try:
+        element = get_object_or_404(Element, paragraph_id=paragraph_id)
+    except Http404:
+        #creating chapter name from paragraph_id surely there is a better way using the context but i do not know as yet
+        chapter_id='_'.join(paragraph_id.split('_')[0:-1])
+        chapter_name=chapter_id[-1::-1].replace('_','/',1)[-1::-1]
+        element=Element(chapter_name=chapter_name,paragraph_id=paragraph_id)
+        element.save()
+    print element.chapter_name
     form = None
     newid = None
+    
     if request.method == 'POST':
         form = CommentForm(request.POST)
+        print form.errors
         if form.is_valid():
+            print form.cleaned_data
             data = form.cleaned_data
             if data.get('remember'):
                 request.session['name'] = data['name']
@@ -101,15 +152,16 @@
                         submitter_name=data['name'],
                         submitter_url=data['url'],
                         ip=request.META.get('REMOTE_ADDR'))
+            print c
             c.save()
-            newid = c.id
+           
             form = None
-    return single(request, id, form, newid)
+    return single(request, paragraph_id, form,)
 
 def test(request):
     print request
     string="<p>test comment</p>"
-    return HttpResponse(dumps(string),mimetype="application/json")
+    return HttpResponse(string,mimetype="text/plain")
     
        
 
Binary file sphinx_django/sphinxcomment/views.pyc has changed
--- a/sphinx_django/sphinxcomment/views.py~	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/sphinxcomment/views.py~	Fri Oct 15 15:59:28 2010 +0530
@@ -4,27 +4,30 @@
 from django.contrib.csrf.middleware import csrf_exempt
 import django.forms as forms
 from django.db import connection
-from django.http import HttpResponse
+from django.http import HttpResponse,Http404
 from sphinxcomment.models import Comment, Element
 from django.shortcuts import get_object_or_404, render_to_response
 from django.template import Context
 from django.template.loader import get_template
 from django.utils.simplejson import dumps 
 
-# def dump_queries():
-#     # requires settings.DEBUG to be set to True in order to work
-#     if len(connection.queries) == 1:
-#         print connection.queries
-#     else:
-#         qs = {}
-#         for q in connection.queries:
-#             qs[q['sql']] = qs.setdefault(q['sql'], 0) + 1
-#         for q in sorted(qs.items(), key=lambda x: x[1], reverse=True):
-#             print q
-#         print len(connection.queries)
+
+placeholder_string = open('paragraph_id.py').read()
+exec placeholder_string
+
+def dump_queries():
+    # requires settings.DEBUG to be set to True in order to work
+    if len(connection.queries) == 1:
+        print connection.queries
+    else:
+        qs = {}
+        for q in connection.queries:
+            qs[q['sql']] = qs.setdefault(q['sql'], 0) + 1
+        for q in sorted(qs.items(), key=lambda x: x[1], reverse=True):
+            print q
+        print len(connection.queries)
 
 class CommentForm(forms.Form):
-    id = forms.CharField(widget=forms.HiddenInput)
     name = forms.CharField(max_length=64)
     url = forms.URLField(max_length=128, required=False)
     comment = forms.CharField(widget=forms.Textarea(attrs={
@@ -33,48 +36,78 @@
     remember = forms.BooleanField(initial=True, required=False)
 
 def comments_by_chapter(chapter):
-    objs = {}
-    for c in Comment.objects.filter(element__chapter=id, hidden=False).order_by('date'):
-        objs.setdefault(c.element_id, []).append(c)
-    return objs
+     objs = {}
+
+     try:
+         para_list=p_list[chapter]
+
+         for paragraph_id in para_list:
+           objs[paragraph_id]=[] 
+
+     except:
+         para_list=[]
+
+     for paragraph_id in para_list:
+         
+         for c in Comment.objects.filter(element__chapter_name=chapter,element__paragraph_id=paragraph_id).order_by('date'):
+
+             objs[paragraph_id].append(c)
+
+     return objs
+
+     
+
+
+
 
 def chapter(request):
-#    template = get_template('comment.html')
-#    resp = {}
-    # for elt, comments in comments_by_chapter(id).iteritems():
-    form = CommentForm(initial={
-            'id': 'elt',
-            'name': 'name'
+    template = get_template('comment.html')
+    resp = {}
+    for elt, comments in comments_by_chapter(chapter).iteritems():
+        print elt ,comments
+        form = CommentForm(initial={
+            'paragraph_id': elt,
+            'name': name
             })
-    resp['elt'] = template.render(Context({
-            'id': 'elt',
+        resp[elt] = template.render(Context({
+            'paragraph_id': elt,
             'form': form,
-            'length': 5,
-            'query': 'abcde',
+            'length': len(comments),
+            'query': comments,
             }))
     return HttpResponse(dumps(resp), mimetype='application/json')
 
-def chapter_count(request):
-#     resp = comments_by_chapter(chapter_name)
-# #   for elt, comments in resp.iteritems():
-# #        resp[elt] = len(comments)
+def chapter_count(request,chapter_name):
+    print chapter_name
+    chapter_name=chapter_name.split('.')[0]
+    comment_objs = comments_by_chapter(chapter_name)
     resp={}
-    resp['elt']=5
+    temp_dict={}
+    for elt, comments in comment_objs.iteritems():
+        temp_dict[elt]=len(comments)
+
+    resp['count']=temp_dict
+      
+    
+    print resp
     return HttpResponse(dumps(resp), mimetype='application/json')
     
-def single(request, id, form=None, newid=None):
-    queryset = Comment.objects.filter(element=id, hidden=False).order_by('date')
+def single(request,paragraph_id, form=None, newid=None):
+    paragraph_id=paragraph_id[:-1]
+    queryset = Comment.objects.filter(element=paragraph_id)
+    print paragraph_id 
     if form is None:
         form = CommentForm(initial={
-            'id': id,
+            'paragraph_id': paragraph_id,
             'name': request.session.get('name', ''),
             })
     try:
         error = form.errors[0]
     except:
         error = ''
+    print form.errors
     return render_to_response('comment.html', {
-        'id': id,
+        'paragraph_id': paragraph_id,
         'form': form,
         'length': len(queryset),
         'query': queryset,
@@ -82,13 +115,26 @@
         'error': error,
         })
 
-def submit(request, id):
-    element = get_object_or_404(Element, id=id)
+
+
+
+def submit(request, paragraph_id):
+    try:
+        element = get_object_or_404(Element, paragraph_id=paragraph_id)
+    except Http404:
+        chapter_id='_'.join(paragraph_id.split('_')[0:-1])
+        chapter_name=chapter_id.replace('_','/')
+        element=Element(chapter_name=chapter_name,paragraph_id=paragraph_id)
+        element.save()
+    print element.chapter_name
     form = None
     newid = None
+    
     if request.method == 'POST':
         form = CommentForm(request.POST)
+        print form.errors
         if form.is_valid():
+            print form.cleaned_data
             data = form.cleaned_data
             if data.get('remember'):
                 request.session['name'] = data['name']
@@ -101,15 +147,16 @@
                         submitter_name=data['name'],
                         submitter_url=data['url'],
                         ip=request.META.get('REMOTE_ADDR'))
+            print c
             c.save()
-            newid = c.id
+           
             form = None
-    return single(request, id, form, newid)
+    return single(request, paragraph_id, form,)
 
 def test(request):
     print request
     string="<p>test comment</p>"
-    return HttpResponse(dumps(string),mimetype="application/json")
+    return HttpResponse(string,mimetype="text/plain")
     
        
 
--- a/sphinx_django/templates/comment.html	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/templates/comment.html	Fri Oct 15 15:59:28 2010 +0530
@@ -1,7 +1,54 @@
+<style type="text/css">
+.comment {
+  font-size: 90%;
+}
+
+
+
+
+.comment_body {
+  background: #eeeeff;
+}
+
+
+.comment_header {
+  opacity: 0.75;
+}
+
+.comment_id {
+  float: right;
+  opacity: 0.3;
+  font-size: 60%;
+}
+
+.comment_name {
+  font-weight: bolder;
+}
+
+
+.comment_date {
+  opacity: 0.75;
+}
+
+.comment_thanks {
+  color: darkblue;
+  margin-left: 1em;
+  font-style: italic;
+  font-weight: bolder;
+}
+
+.comment_error {
+  padding-left: 1em;
+  font-weight: bolder;
+  font-size: 80%;
+  color: darkred;
+}
+</style>
+
 {% ifequal length 1 %}
   <a class="commenttoggle" id="toggle_{{ id }}"
       onclick="return toggleComment('{{ id }}')"
-      href="comments: show / hide">One comment</a>
+      href="comments: show / hide">{{ length }} comments</a>
 {% else %}
   {% if length %}
     <a class="commenttoggle" id="toggle_{{ id }}"
@@ -10,47 +57,30 @@
   {% else %}
     <a class="commenttoggle" id="toggle_{{ id }}"
       onclick="return toggleComment('{{ id }}')"
-      href="comments: show / hide">No comments</a>
-    <div class="comment" {% if not newid %} style="display: none;" {% endif %}>
-      <div class="comment_body">Be the first to comment on this paragraph!</div>
-    </div>
+      href="comments: show / hide">0 comments</a>
+    <span class="comment" {% if not newid %} style="display: none;" {% endif %}>
+      <span class="comment_body">Be the first to comment on this paragraph!</span>
+    </span>
   {% endif %}
 {% endifequal %}
 {% for c in query %}
-  <div class="{% ifequal c.id newid %}new_{% endifequal %}comment"
+  <span class="{% ifequal c.id newid %}new_{% endifequal %}comment"
       {% if not newid %} style="display: none;" {% endif %}
     id="comment{{ c.id }}">
     <a name="comment{{ c.id }}"/>
-    <div class="comment_header">
-	<span class="comment_id"><a href="/admin/comments/comment/{{ c.id }}/">{{ c.id }}</a></span>
-      {% if c.submitter_url %}
-	<span class="comment_name"><a rel="nofollow"
-	  href="{{ c.submitter_url }}">{{ c.submitter_name|escape }}</a></span>
-      {% else %}
-	<span class="comment_name">{{ c.submitter_name|escape }}</span>
-      {% endif %}
-      <span class="comment_date">{{ c.date|date:"Y-m-d" }}</span>
-      {% if c.reviewed %}
-	<span class="comment_reviewed">(reviewed)</span>
-      {% endif %}
-      {% ifequal c.id newid %}
-	<span class="comment_thanks">thank you for your comment!</span>
-      {% endifequal %}
-    </div>
-    <div class="comment_body">{{ c.comment|escape|linebreaks }}</div>
-  </div>
+    <span class="comment_header">
+    </span>
+    <div class="comment_body">{{ forloop.counter }}   {{ c.submitter_name }}  {{ c.comment|escape|linebreaks }}</div>
+  </span>
 {% endfor %}
-<form class="comment" id="form_{{ id }}" action="/comments/submit/{{ id }}/"
-    method="post" {% if not newid %} style="display: none;" {% endif %}>
-  {{ form.id }}
+<form class="comment" id="form_{{ paragraph_id }}" action="/submit/{{  paragraph_id }}/"
+    method="post" >
   <table>
     <tbody>
-      <tr><td align="right" valign="top">Comment<br><a class="comment_help"
-		href="web.html#web.comment">[ help ]</a></td>
+      <tr><td align="right" valign="top">Comment<br></td>
 	  <td>{{ form.comment }}</td></tr>
       <tr><td align="right">Your name</td><td>{{ form.name }}
-	    <span class="comment_help"><b>Required</b> so we can <a
-		href="web.html#web.comment.name">give you credit</a></span></td></tr>
+	    <span class="comment_help"><b>Required</b> so we can give you credit</a></span></td></tr>
       <tr><td align="right">Your URL</td><td>{{ form.url }}
 	    <span class="comment_help"><b>Optional</b> link to blog, home page,
 	      <i>etc</i>.</span></td></tr>
Binary file sphinx_django/test.db has changed
--- a/sphinx_django/urls.py	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/urls.py	Fri Oct 15 15:59:28 2010 +0530
@@ -10,11 +10,11 @@
 
     (r'^test/','sphinxcomment.views.test' ),
     (r'chapter/', 'sphinxcomment.views.chapter'),
-    (r'count/(?P<chapter_name>[^/]+)/?$', 'sphinxcomment.views.chapter_count'),                  
-    (r'single/(?P<id>[^/]+)/?$', 'sphinxcomment.views.single'),
-    (r'submit/(?P<id>[^/]+)/?$', 'sphinxcomment.views.submit'),
+    (r'count/(?P<chapter_name>.+)?$', 'sphinxcomment.views.chapter_count'),                  
+    (r'single/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.single'),
+    (r'submit/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.submit'),
     (r'^static/(?P<path>.*)$', 'django.views.static.serve',
-     {'document_root': '/home/amit/review/sttp/_build/html/'}),
+     {'document_root': '/home/amit/review/sttp_test/_build/commenthtml'}),
                        
     # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
     # to INSTALLED_APPS to enable admin documentation:
Binary file sphinx_django/urls.pyc has changed
--- a/sphinx_django/urls.py~	Thu Sep 30 15:59:32 2010 +0530
+++ b/sphinx_django/urls.py~	Fri Oct 15 15:59:28 2010 +0530
@@ -10,11 +10,11 @@
 
     (r'^test/','sphinxcomment.views.test' ),
     (r'chapter/', 'sphinxcomment.views.chapter'),
-    (r'count/', 'sphinxcomment.views.chapter_count'),                  
-    (r'single/(?P<id>[^/]+)/?$', 'sphinxcomment.views.single'),
-    (r'submit/(?P<id>[^/]+)/?$', 'sphinxcomment.views.submit'),
+    (r'count/(?P<chapter_name>.+)?$', 'sphinxcomment.views.chapter_count'),                  
+    (r'single/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.single'),
+    (r'submit/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.submit'),
     (r'^static/(?P<path>.*)$', 'django.views.static.serve',
-     {'document_root': '/home/amit/review/sttp/_build/html/'}),
+     {'document_root': '/home/amit/review/sttp_test/_build/commenthtml/'}),
                        
     # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
     # to INSTALLED_APPS to enable admin documentation: