File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 user_passes_test )
1010from django .contrib .auth .models import Group , User
1111from django .contrib .contenttypes .models import ContentType
12+ from django .core .cache import cache
13+ from django .core .cache .utils import make_template_fragment_key
1214from django .db import transaction
1315from django .db .models import Count , Max
1416from django .http import Http404 , HttpResponseRedirect
@@ -171,6 +173,12 @@ def change_profile(request):
171173 with transaction .atomic ():
172174 request .user .save ()
173175 profile_form .save ()
176+
177+ # Invalidate userlist.html template cache fragment.
178+ for group in request .user .groups .all ():
179+ key = make_template_fragment_key ('dev-tu-profiles' , [group .name ])
180+ cache .delete (key )
181+
174182 return HttpResponseRedirect ('/devel/' )
175183 else :
176184 form = ProfileForm (initial = {'email' : request .user .email })
You can’t perform that action at this time.
0 commit comments