Changeset View
Changeset View
Standalone View
Standalone View
profiles/views/streams.py
- This file was added.
| """Profile activity pages, such as notifications and My activity.""" | |||||
| from django.shortcuts import render | |||||
| from django.contrib.auth import get_user_model | |||||
| from django.contrib.auth.decorators import login_required | |||||
| from django.contrib.contenttypes.models import ContentType | |||||
| from actstream.models import models | |||||
| USER_MODEL = get_user_model() | |||||
| @login_required | |||||
| def notifications(request): | |||||
| """Display notifications for an authenticated user.""" | |||||
| return render( | |||||
| request, | |||||
| 'profiles/activity.html', | |||||
| context={ | |||||
| 'ctype': ContentType.objects.get_for_model(USER_MODEL), | |||||
| 'actor': request.user, | |||||
| 'action_list': models.Action.objects.notifications(request.user), | |||||
| }, | |||||
| ) | |||||
| @login_required | |||||
| def activity(request): | |||||
| """Display latest activity of an authenticated user.""" | |||||
| return render( | |||||
| request, | |||||
| 'profiles/activity.html', | |||||
| context={ | |||||
| 'ctype': ContentType.objects.get_for_model(USER_MODEL), | |||||
| 'actor': request.user, | |||||
| 'action_list': models.actor_stream(request.user), | |||||
| }, | |||||
| ) | |||||