v1k45 / django-notify-x

Notification system for Django
MIT License
187 stars 40 forks source link

Mark read/ Delete also not working! #38

Closed vivaelnino9 closed 7 years ago

vivaelnino9 commented 7 years ago

Hey!

So as the title says, the marked read or delete feature for notifications is not working. Not sure if it is something I'm doing wrong or not. I tried to follow the documentation as tightly as I could.

#myapp/views.py

  def myview(request):
      user = User.objects.get(username='Test')
      notify.send(request.user, recipient=request.user, actor=user,
                verb='followed you', nf_type='followed_user')
      return render(request,'test.html')

#myapp/test.html

{% extends 'base.html' %}
{% load notification_tags staticfiles %}

{% block content %}
<div class="notifications">
{% user_notifications %}
</div>
<script src="{% static "notify/notifyX.min.js" %}"></script>
{% endblock %}

However, when I run test.html that is supposed to just list all the notifications the current user(admin) has, it lists all of them perfectly however the buttons for mark as read or delete don't work. Along with that, I get the console message:

Notity improperly configured. No data-nf-id was found. Make sure you have a container element with 'undefined' as css class.

I've tried adding the {% include_notify_js_variables %} tag but a Django error is displayed saying that the tag has not been loaded, even with the {% load notification_tags %} at the top.

Looking at the notifyX.js file I can see where it goes wrong however I don't know how to avoid it. I've looked at the other issue involving the same subject buy it didn't seem to help.

v1k45 commented 7 years ago

Have you referred #37 ?

The submitter was also facing the same problem, turns out he needed to do the following things:

vivaelnino9 commented 7 years ago

Ah it was {% include_notify_js_variables %} that did it! Thanks!