def activate(request, key): key = get_object_or_404(Key, slug=key, user=request.user) if key.is_disabled: key.is_disabled = False key.save() request.log_action(key, notes='Key activated') return HttpResponseRedirect(reverse('account:keys:detail', args=(key.slug,)))
def persona_logout(text='Sign out', next='', link_class='browserid-logout', attrs=None): return browserid_button(_(text), next, link_class, attrs, reverse('browserid.logout'))
def mark_as_unread(request, slug=None): message = get_object_or_404(Notice, slug=slug, recipient=request.user) message.unseen = True message.save() return HttpResponseRedirect(reverse('account:notifications:list'))
def archive(request, slug=None): message = get_object_or_404(Notice, slug=slug, recipient=request.user) message.archive() return HttpResponseRedirect(reverse('account:notifications:list'))
def mark_all_as_read(request): for messages in request.user.get_messages.filter(unseen=True): message.unseen = False message.save() return HttpResponseRedirect(reverse('account:notifications:list'))