Skip to content
Advertisement

Django ajax: in call does not make any changes

So I made this ajax view for my user model

JavaScript

I extends my user model with an Integerfield of notification, but when I call the ajax it does not give +1 to my notification model, does anybody know what is going on?

my urls.py

JavaScript

and my ajax call

JavaScript

my user profile model

JavaScript

Advertisement

Answer

So, change url:

JavaScript

Then, change the view function:

JavaScript

Then, in your ajax call in the template, change the url to: /ajax/new_notification/{{ user.username }}

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement