Example #1
0
def view_notification(request, notification_id):
    """ get the notification depending on nid.
    Display it.
    """

    user = request.user
    newest, newer, notification, older, oldest = get_notification(
        notification_id, user)

    if not notification:
        raise http.Http404

    notification.is_read = True
    notification.save()

    context = {
        'user': user,
        'notification': notification,
        'newest': newest,
        'newer': newer,
        'older': older,
        'oldest': oldest,
    }

    return shortcuts.render_to_response('profile/view_notification.html',
                                        RequestContext(request, context))
Example #2
0
def view_notification(request, notification_id):
    """ get the notification depending on nid.
    Display it.
    """

    user = request.user
    newest, newer, notification, older, oldest = get_notification(
      notification_id, user)

    if not notification:
        raise http.Http404

    notification.is_read = True
    notification.save()

    context = {'user':user,
               'notification':notification,
               'newest':newest,
               'newer':newer,
               'older':older,
               'oldest':oldest,
              }

    return shortcuts.render_to_response(
      'profile/view_notification.html', RequestContext(request, context))
Example #3
0
def delete_notification(request, notification_id):
    """ check if the user owns the notification and delete it.
    """

    user = request.user
    newest, newer, notification, older, oldest = get_notification(notification_id, user)

    if not notification:
        raise http.Http404

    notification.is_deleted = True
    notification.save()

    if older:
        redirect_url = reverse("view_notification", kwargs={"notification_id": older.id})
    else:
        redirect_url = reverse("browse_notifications")

    return shortcuts.redirect(redirect_url)
Example #4
0
def unread_notification(request, notification_id):
    """ check if the user owns the notification and delete it.
    """

    user = request.user
    newest, newer, notification, older, oldest = get_notification(
        notification_id, user)

    if not notification:
        raise http.Http404

    notification.is_read = False
    notification.save()

    if older:
        redirect_url = reverse('view_notification',
                               kwargs={'notification_id': older.id})
    else:
        redirect_url = reverse('browse_notifications')

    return shortcuts.redirect(redirect_url)
Example #5
0
def unread_notification(request, notification_id):

    """ check if the user owns the notification and delete it.
    """

    user = request.user
    newest, newer, notification, older, oldest = get_notification(
      notification_id, user)

    if not notification:
        raise http.Http404

    notification.is_read = False
    notification.save()

    if older:
        redirect_url = reverse('view_notification',
                               kwargs={'notification_id': older.id})
    else:
        redirect_url = reverse('browse_notifications')

    return shortcuts.redirect(redirect_url)