Mercurial > public > sg101
comparison gpp/bio/views.py @ 178:d51743322bb2
#56 - Cut over to Django 1.2 messaging system.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 17 Mar 2010 03:12:05 +0000 |
parents | ab7830b067b3 |
children | b4305e18d3af |
comparison
equal
deleted
inserted
replaced
177:9b63ad1f2ad2 | 178:d51743322bb2 |
---|---|
4 | 4 |
5 from django.shortcuts import render_to_response | 5 from django.shortcuts import render_to_response |
6 from django.shortcuts import get_object_or_404 | 6 from django.shortcuts import get_object_or_404 |
7 from django.template import RequestContext | 7 from django.template import RequestContext |
8 from django.contrib import auth | 8 from django.contrib import auth |
9 from django.contrib import messages | |
9 from django.http import HttpResponse | 10 from django.http import HttpResponse |
10 from django.http import HttpResponseBadRequest | 11 from django.http import HttpResponseBadRequest |
11 from django.http import HttpResponseRedirect | 12 from django.http import HttpResponseRedirect |
12 from django.core.paginator import InvalidPage | 13 from django.core.paginator import InvalidPage |
13 from django.core.urlresolvers import reverse | 14 from django.core.urlresolvers import reverse |
140 profile.avatar.delete(save=False) | 141 profile.avatar.delete(save=False) |
141 if file is not None: | 142 if file is not None: |
142 profile.avatar.save(form.get_filename(), file, save=False) | 143 profile.avatar.save(form.get_filename(), file, save=False) |
143 profile.save() | 144 profile.save() |
144 | 145 |
145 request.user.message_set.create(message='Avatar updated.') | 146 messages.success(request, 'Avatar updated') |
146 return HttpResponseRedirect(reverse('bio-me')) | 147 return HttpResponseRedirect(reverse('bio-me')) |
147 else: | 148 else: |
148 form = UploadAvatarForm() | 149 form = UploadAvatarForm() |
149 | 150 |
150 return render_to_response('bio/avatar.html', { | 151 return render_to_response('bio/avatar.html', { |