Merge pull request #12 from R4stl1n/master

update
This commit is contained in:
Mr McClain 2016-02-25 01:15:31 -06:00
commit 8a8f2559e2
2 changed files with 7 additions and 6 deletions

View File

@ -189,5 +189,5 @@ urlpatterns = patterns('',
# Notifications # Notifications
url(r'^notifications/$', 'notifications.views.notification_list', name='auth_notification_list'), url(r'^notifications/$', 'notifications.views.notification_list', name='auth_notification_list'),
url(r'^notifications/(\w+)/$', 'notifications.views.notification_view', name='auth_notification_view'), url(r'^notifications/(\w+)/$', 'notifications.views.notification_view', name='auth_notification_view'),
url(r'^remove_notifications/(\w+)', 'notifications.views.remove_notification', name='auth_remove_notification'), url(r'^remove_notifications/(\w+)/$', 'notifications.views.remove_notification', name='auth_remove_notification'),
) )

View File

@ -33,8 +33,9 @@ def notification_view(request, notif_id):
@login_required @login_required
def remove_notification(request, notif_id): def remove_notification(request, notif_id):
logger.debug("remove notification called by user %s for notif_id %s" % (request.user, notif_id)) logger.debug("remove notification called by user %s for notif_id %s" % (request.user, notif_id))
if Notification.objects.filter(id=notif_id).exists():
notif = get_object_or_404(Notification, pk=notif_id) notif = get_object_or_404(Notification, pk=notif_id)
if notif.user == request.user:
if Notification.objects.filter(id=notif_id).exists():
notif.delete() notif.delete()
logger.info("Deleting notif id %s by user %s" % (notif_id, request.user)) logger.info("Deleting notif id %s by user %s" % (notif_id, request.user))
else: else: