Unverified Commit 767feb12 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧 Committed by GitHub
Browse files

Merge pull request #242 from kyrias/invalidate-profile-update

devel/views: Invalidate template fragment cache on profile update
parents 184bf569 2685a080
......@@ -9,6 +9,8 @@
from django.contrib.auth.models import Group, User
from django.contrib.contenttypes.models import ContentType
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
from django.db import transaction
from django.db.models import Count, Max
from django.http import Http404, HttpResponseRedirect
......@@ -171,6 +173,12 @@ def change_profile(request):
with transaction.atomic():
# Invalidate userlist.html template cache fragment.
for group in request.user.groups.all():
key = make_template_fragment_key('dev-tu-profiles', [group.name])
return HttpResponseRedirect('/devel/')
form = ProfileForm(initial={'email': request.user.email})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment