Hi there,

The Comments package is a beast, but it seems that the FreeComments  
themselves are relatively simple – apart from some nice error checking  
and validation, the majority of the code is the sneaky mechanism by  
which you can attach comments to any content type in your project. If  
you know for sure that you're only going to allow comments on Entry  
and Link objects, you can make your own Comments and use an  
intermediary table 
(http://www.djangoproject.com/documentation/models/m2m_intermediary/ 
) or something similar to keep track of which Comment is attached to  
which Entry/Link.

Not being able to do much coding is going to become a problem sooner  
or later, though. If you take the above route, I see two bouts of  
coding in your future – one in writing the view which posts the  
comment (can't use generic views for that), which will have to detect  
whether it was an Entry or a Link which received the comment, and then  
create both the Comment object itself and the object in the  
intermediary table which represents the connection between Comment and  
target object. The second would be a custom template tag or two, to  
put in your templates and output a) a list of existing comments for  
the current Link/Entry and b) a form for adding a new comment.

That sounds ugly, but the goals are clearcut, and it would be a good  
exercise in dipping into coding which, if you're going to use Django,  
you'll have to learn sooner or later :)

Note that this is just one possible solution to the problem, I'm sure  
others would come at it quite differently...

Good luck,
Eric


On Mar 10, 2008, at 12:32 PM, stranger wrote:

>
> Thank you Eric for the reply. Well I am new to django I cannot do that
> much of coding. I want to know one thing.
>
> If  I create a comment model with my desired fields, can I use that
> comment model with the entry and Link models. Note I am using generic
> views for my blog app.
>
>
>
> On Mar 9, 7:15 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
>>> I tried this but I have some problem with the preview template....
>>> There are errors showing up in the freepreview.html
>>> I dont prefer to preview the comment. I like to get it posted and  
>>> also
>>> I want to include markdown syntax...
>>
>> This part of the 
>> page:http://code.djangoproject.com/wiki/UsingFreeComment#Wrappingpost_free 
>> ...
>>
>> shows you how to short-circuit the preview function so the comment is
>> posted directly. That's been working well for me, and I've added  
>> other
>> features (ajax checking, etc) into it with no problem.
>>
>> The simplest way to to use markdown is to run the output through the
>> markdown filter in your template. Otherwise you'd have to override  
>> the
>> FreeComment model's save() function and use the markdown module
>> directly. It might be possible to weasel this into the
>> my_post_free_comment() function in the link above, come to think of
>> it, but that's baseless speculation...
>>
>> Eric
>>
>>
>>
>>> On Mar 9, 1:37 pm, "[EMAIL PROTECTED]"
>>> <[EMAIL PROTECTED]> wrote:
>>>> I'm not sure if you've seen this but check this page out.
>>
>>>> http://code.djangoproject.com/wiki/
>>>> UsingFreeComment#AddingCommentstoD...
>>
>>>> It's pretty much exactly how I'm doing it.
>>
>>>> On Mar 9, 4:16 pm, stranger <[EMAIL PROTECTED]> wrote:
>>
>>>>> Hi I think after thinking a while I felt its much better to  
>>>>> create a
>>>>> comment model for linking to both entry and link models. But I  
>>>>> dont
>>>>> have to idea how to use the comment in the templates with generic
>>>>> views...
>>
>>>>> Can anybody help me in this regard.
>>
>>>>> On Mar 9, 12:55 pm, stranger <[EMAIL PROTECTED]> wrote:
>>
>>>>>> Thats a good idea...since we are not changing the django  
>>>>>> framework
>>>>>> files we are making a local copy and working on it. Indeed you  
>>>>>> are
>>>>>> very helpful. I'll try to do that for now and see. But writing a
>>>>>> comment model is easy. But I dont know how to use that model in
>>>>>> entry
>>>>>> detail page.
>>
>>>>>> Anyway I need one more favour regarding the template for  
>>>>>> comment. I
>>>>>> could n't find much documentation on using comment model. Can you
>>>>>> tell
>>>>>> me how to use it?
>>
>>>>>> Thank you for the help... your  help is much appreciated.
>>
>>>>>> On Mar 9, 12:44 pm, "[EMAIL PROTECTED]"
>>
>>>>>> <[EMAIL PROTECTED]> wrote:
>>>>>>> Stranger,
>>
>>>>>>> I'll go ahead and warn you that I won't be much help.  In fact,
>>>>>>> I'm
>>>>>>> trying to do the exact same thing but have hit a road block.
>>
>>>>>>> From what I understand, editing the django.contrib.comments  
>>>>>>> app in
>>>>>>> it's current location is a bad thing if you ever plan on  
>>>>>>> upgrading
>>>>>>> django in the future.  So, I've copied the entire folder and
>>>>>>> placed it
>>>>>>> in my project folder.  From there, I added fields for URL and E-
>>>>>>> mail
>>>>>>> in the FreeComments model and changed any of the
>>>>>>> django.contrib.comments to just comments (since it lives in my
>>>>>>> project
>>>>>>> folder) in any of the .py files that referenced
>>>>>>> django.contrib.comments.
>>
>>>>>>> This put the URL and e-mail fields in my database and admin for
>>>>>>> FreeComment but now, I am unable to use {% load comments %} in  
>>>>>>> my
>>>>>>> templates.
>>
>>>>>>> That is where I am stuck at the moment.
>>
>>>>>>> Maybe that will spark something in your attempt to customize
>>>>>>> Comments....
>>
>>>>>>> Post any updates you can and I'll do the same.
>>
>>>>>>> On Mar 9, 2:48 pm, stranger <[EMAIL PROTECTED]> wrote:
>>
>>>>>>>> Hello,
>>
>>>>>>>>        I would like to add comments(Freecomments) to Entry and
>>>>>>>> Link
>>>>>>>> model in blog application.
>>>>>>>> I wish the comment model have name, email, website and body.  
>>>>>>>> Can
>>>>>>>> anyone suggest me how to achieve this.
>>
>>>>>>>> The freecomments do not have website and email fields. if I
>>>>>>>> write a
>>>>>>>> model comment with these fields and sync with database. How to
>>>>>>>> use
>>>>>>>> that model in entry details page?
>>>>>>>> also how to add akismet support to the comment model?
> >


--~--~---------~--~----~------------~-------~--~----~
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