Giter Club home page Giter Club logo

Comments (9)

diox avatar diox commented on September 3, 2024

Use the non-ajax version (just disable JavaScript) or use Firebug/Web Inspector to look at the content of the XHR response. It's probably a 500 or a 400, but the JavaScript hides the real error for the user.

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

Stupid. Forgot to include the mptt_comments_media in the HEAD section (included it in BODY by accident). However, now I'm getting:

CSRF token missing or incorrect.

when hitting Preview.

(i'm looking like such a noob ... sorry about that)

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

Okay, I guess it's because the csrftoken isn't sent in the javascript POST function. I'm going to try to modify the .js file and see if I can get it working. If you have already solved this problem, please let me know :) Else I'll do a pull request if i get it working (new file probably, to support both methods?).

from django-mptt-comments.

diox avatar diox commented on September 3, 2024

IIRC ajax posts don't require the token. Furthermore, since the post is made by using $(":input", form).serializeArray(), the XHR request should contain the CSRF token. I can't reproduce this problem.

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

According to this page: https://docs.djangoproject.com/en/1.3/ref/contrib/csrf/#ajax they do require it. After adding the js code, I don't get the csrf error anymore. Seems like the only thing going wrong now is this error:

Caught NoReverseMatch while rendering: Reverse for 'comment-detail' with arguments '(None,)' and keyword arguments '{}' not found.

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

Update on this issue. I noticed I didn't have anything enabled for django-notification in my urlconf. So now it looks like this:

# comments
(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog),
(r'^comments/', include('mptt_comments.urls')),
(r'^comments/', include('notification.urls')),
(r'^comments/', include('django.contrib.comments.urls')),

And after commenting out the 'Preview' button in form.html , it now works :) Two things that kind of bother me still though:

  1. why doesn't it work when i hit Preview (i get the abovementioned NoReversematch error
  2. when I submit a comment, the form gets replaced by a text "Your comment was posted" and only after reloading the page, the form reappears. How can I always show the form?

thanks for your patience and nice work :)

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

I looked at Firebug while posting and something weird happens. The form gets POSTed succesfully, but then it tries to post it again :

POST http://localhost:8000/comments/post/ 302 FOUND     549ms   
POST http://localhost:8000/comments/post/ 400 BAD REQUEST   544ms   
"NetworkError: 400 BAD REQUEST - http://localhost:8000/comments/post/"    /comments/post/
GET http://localhost:8000/comments/posted-ajax/?c=27  201 CREATED   35ms    

Any idea?

from django-mptt-comments.

lkeijser avatar lkeijser commented on September 3, 2024

I'm an idiot :( Included the .js file twice .. Feel free to laugh and mock me and stuff

from django-mptt-comments.

diox avatar diox commented on September 3, 2024

:) Not a problem. Still doesn't explain the NoReverseMatch problem. Can you open a specific issue about that, re-explaining the issue without all the other comments ? It might be a problem in the default templates, I don't use them all in the main project that uses mptt_comments, so I might have forgot to update one of them.

from django-mptt-comments.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.