Runs black
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
''' non-interactive pages '''
|
||||
""" non-interactive pages """
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
@ -7,22 +7,22 @@ from django.views import View
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class Notifications(View):
|
||||
''' notifications view '''
|
||||
""" notifications view """
|
||||
|
||||
def get(self, request):
|
||||
''' people are interacting with you, get hyped '''
|
||||
notifications = request.user.notification_set.all() \
|
||||
.order_by('-created_date')
|
||||
""" people are interacting with you, get hyped """
|
||||
notifications = request.user.notification_set.all().order_by("-created_date")
|
||||
unread = [n.id for n in notifications.filter(read=False)]
|
||||
data = {
|
||||
'notifications': notifications,
|
||||
'unread': unread,
|
||||
"notifications": notifications,
|
||||
"unread": unread,
|
||||
}
|
||||
notifications.update(read=True)
|
||||
return TemplateResponse(request, 'notifications.html', data)
|
||||
return TemplateResponse(request, "notifications.html", data)
|
||||
|
||||
def post(self, request):
|
||||
''' permanently delete notification for user '''
|
||||
""" permanently delete notification for user """
|
||||
request.user.notification_set.filter(read=True).delete()
|
||||
return redirect('/notifications')
|
||||
return redirect("/notifications")
|
||||
|
Reference in New Issue
Block a user