comparison gpp/bio/views.py @ 562:98b373ca09f3

For bitbucket issue #3, ensure that changes to Profile, Post & Topic models via the admin cause the search index to be updated.
author Brian Neal <bgneal@gmail.com>
date Wed, 08 Feb 2012 18:58:57 -0600
parents d83296cac940
children
comparison
equal deleted inserted replaced
561:8f3b7f0d4d13 562:98b373ca09f3
8 from django.contrib import messages 8 from django.contrib import messages
9 from django.contrib.auth.models import User 9 from django.contrib.auth.models import User
10 from django.http import HttpResponse 10 from django.http import HttpResponse
11 from django.http import HttpResponseBadRequest 11 from django.http import HttpResponseBadRequest
12 from django.http import HttpResponseRedirect 12 from django.http import HttpResponseRedirect
13 from django.http import HttpResponseServerError
13 from django.http import Http404 14 from django.http import Http404
14 from django.core.paginator import InvalidPage 15 from django.core.paginator import InvalidPage
15 from django.core.urlresolvers import reverse 16 from django.core.urlresolvers import reverse
16 from django.contrib.auth.decorators import login_required 17 from django.contrib.auth.decorators import login_required
17 from django.views.decorators.http import require_POST 18 from django.views.decorators.http import require_POST
124 if user_form.is_valid() and profile_form.is_valid(): 125 if user_form.is_valid() and profile_form.is_valid():
125 user_form.save() 126 user_form.save()
126 profile = profile_form.save(commit=False) 127 profile = profile_form.save(commit=False)
127 profile.user = request.user 128 profile.user = request.user
128 profile.save() 129 profile.save()
129 notify_profile_content_update(profile)
130 return HttpResponseRedirect(reverse('bio.views.my_profile')) 130 return HttpResponseRedirect(reverse('bio.views.my_profile'))
131 else: 131 else:
132 profile = request.user.get_profile() 132 profile = request.user.get_profile()
133 user_form = EditUserForm(instance=request.user) 133 user_form = EditUserForm(instance=request.user)
134 profile_form = EditUserProfileForm(instance=profile) 134 profile_form = EditUserProfileForm(instance=profile)
228 228
229 if form.is_valid(): 229 if form.is_valid():
230 profile = form.save(commit=False) 230 profile = form.save(commit=False)
231 profile.user = request.user 231 profile.user = request.user
232 profile.save() 232 profile.save()
233 notify_profile_content_update(request.user.get_profile())
234 return HttpResponseRedirect(request.path) 233 return HttpResponseRedirect(request.path)
235 234
236 # Delete forms 235 # Delete forms
237 elif new_data.get('delete-sn-form') or new_data.get('delete-im-form') or new_data.get('delete-w-form'): 236 elif new_data.get('delete-sn-form') or new_data.get('delete-im-form') or new_data.get('delete-w-form'):
238 delete_id = request.POST['delete_id'] 237 delete_id = request.POST['delete_id']