Guest User

Untitled

a guest
May 26th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. // view
  2.  
  3. def profile(request):
  4. profile = RegistrationProfile.objects.filter(user=request.user)[0]
  5. if request.method == 'POST':
  6. form = ProfileForm(request.POST,instance=profile)
  7. if form.is_valid():
  8. form.save()
  9. profileForm = ProfileForm(instance=profile)
  10. return render_to_response('accounts/profile.html',
  11. { 'profileForm':profileForm},
  12. context_instance=RequestContext(request))
  13.  
  14. //model contains
  15. photo = models.ImageField(upload_to='profile')
  16. // media
  17. MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'core/web')
  18. PROJECT_ROOT = os.path.dirname(__file__)
Add Comment
Please, Sign In to add comment