liberation / django-mptt-comments

A restful comment system using modified preordered tree traversal ala. slashdot - this fork, designed to work with authenticated comments only, tries to add some useful features that big sites might need
16 stars 5 forks source link

TemplateSyntaxError when rendering / #3

Closed lkeijser closed 12 years ago

lkeijser commented 12 years ago

Sorry to bother you again, but I'm getting another error. Hopefully it's as easy to fix as the other one. I've defined this section in a template:

{% block head %} {% load mptt_comments_tags %} {% get_mptt_comments_media %} {% endblock %}

Obviously, the block 'head' is in the HEAD section of the html. When rendering it, I'm getting:

Invalid block tag: 'get_mptt_comments_media', expected 'endblock' or 'endblock head'

thanks,

Léon

lkeijser commented 12 years ago

Just mentioning that I'm only following the README.rst file so far ..

lkeijser commented 12 years ago

Or should I just look at /mptt_comments/templates/*.html and copy things I like? Sorry, don't mean to abuse the Issue tracker here :( I'm just very interested in getting everything to work without making use of Disqus or non-threaded comments. Thanks in any case.

Edit: I've changed 'get_mptt_comments_media' to 'mptt_comments_media' and now I'm not getting the error anymore. Looks like the README.rst file is a tad outdated. However, I'm now getting this error:

Caught KeyError while rendering: 'MEDIA_URL'

It probably has something to do with switching from django 1.2 to 1.3 (which I've just done), but I'm not sure what.

lkeijser commented 12 years ago

Okay so I've added the proper context processor and got rid of the above error, but I'm still getting certain errors like this one for example:

Caught NoReverseMatch while rendering: Reverse for 'django.views.i18n.javascript_catalog' with arguments '()' and keyword arguments '{'packages': u'mptt_comments'}' not found.

Could you do me a huge favor and paste a working settings/manage/urls.py ? Since I'm probably missing some crucial stuff. I promise not to bother you anymore then :)

diox commented 12 years ago

Yup, sorry about the sad state of the documentation. I really need to update it.

First, make sure you are using django 1.3. Django 1.2 is completely unsupported.

Then, you just need the urls.py that's inside the app, plus django.contrib.comments.urls, and this:

url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),

For context processors, here is what we use:

TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.i18n', 'django.core.context_processors.request', 'django.core.context_processors.media', 'django.core.context_processors.static', )

Note : you'll also need to include jquery in your own base.html to get the javascript working.

lkeijser commented 12 years ago

Okay, almost there then. No problem about the docs, I hate documenting when there's more exiting stuff to do, so I know exactly what you mean.

I have this in my urlconf :

(r'^comments/', include('mptt_comments.urls')),

but how do i include the django.contrib.comments.urls ?

diox commented 12 years ago

You can include it in the same way, in comments/, just make sure to put it below the mptt_comments.urls line. mptt_comments redefines some of the django.contrib.comments urls.

lkeijser commented 12 years ago

Perfect, thanks!

One final question (I really hope you don't mind, you're the only source of help I can find ..). I see a lot of template files and javascript. Are there easy methods of rendering the comments / form / reply-to-comment or do i have to invent my own?

diox commented 12 years ago

The templates that come with the app should be enough to get started. Start with mptt_comments/templates/comments/display_comments_toplevel.html for instance.

Don't hesitate filing bugs or even pull requests for any specific issues you have.