Djangoholics:

I am working on an 'inline comment' system, inspired by the online
Django Book. I want users to be able to comment on any paragraph in my
text.

I'm doing this without looking at the code that drives the Django Book
or Jack Slocum's implementations, because I really like trying to
figure thing out on my own, but I am stuck, and it's kind of hard to
explain where I'm stuck.

Let's say I have a Comment model, which contains the following fields:
* Name - The name of the person leaving the comment
* Comment - The text of the comment
* Chapter - The chapter being commented on
* Paragraph - The paragraph being commented on
* Time - When the comment was made

OK - so far so good. When someone navigate to mybook/chapter02 I can
capture '02', and retrieve all of the comments that are on chapter 2.
I can then pass this to my template.

This is where I start to get confused.

I don't want to track (in my django application) ahead of time how
many paragraphs there are in the chapter text. I can use javascript
(jquery) to determine that. I can loop through and count all of the
paragraphs in the text, and add in the HTML elements (divs and spans)
to denote whether a comment exists for that paragraph.

How can I count the number of comments that exist for each paragraph?
Should I pass the comments to the template as an array of JSON
objects, then use javascript to loop through that array for each
paragraph number, checking for objects that match the paragraph
number, and accumulating the count?

I wish I could explain the problem better, but I guess if I could
explain it better I could probably solve it. I've got most of the look-
and-feel HTML / CSS / Javasript issues solved, but I'm getting stuck
on the logic of using the data Django sends to the template.

-CJL
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to