Exemplo n.º 1
0
def save_profile(request):
    profile = Profile()
    profile.name = request.POST["tmp_name"]
    profile.desc = request.POST["tmp_desc"]
    profile.addr = request.POST["tmp_addr"]
    profile.contact = request.POST["tmp_contact"]
    profile.receiver = request.POST["tmp_receiver"]
    request.session[DRAFT_PROFILE_KEY] = profile 
    
    next = request.POST.get("next", '')
    if not next:
        raise Exception("No any next page")
    return HttpResponseRedirect(next)
Exemplo n.º 2
0
 def save(self, request):
     profile = Profile.objects.get(user=request.user)
     if profile is None:
         profile = Profile(user=request.user)
         
     profile.name = self.cleaned_data.get("name")
     profile.sex = self.cleaned_data.get("sex")
     profile.contact = self.cleaned_data.get("contact")
     profile.addr = self.cleaned_data.get("addr")
     profile.receiver = self.cleaned_data.get("receiver")
     #profile.city = self.getCity()
     #profile.website = self.cleaned_data.get("website")
     #profile.spacename = self.cleaned_data.get("spacename")
     profile.desc = self.cleaned_data.get("desc")
     profile.save()
     
     profileUpdated.send(sender=profile.__class__, request=request, profile=profile) 
     
     return profile