app/soc/views/site/sponsor/profile.py
changeset 267 0c008a43443b
parent 259 74eb6b01c82c
child 269 0f1acc4c3e1e
equal deleted inserted replaced
266:3b47bfd4f1b3 267:0c008a43443b
    29 
    29 
    30 from soc.logic import validate
    30 from soc.logic import validate
    31 from soc.logic import out_of_band
    31 from soc.logic import out_of_band
    32 from soc.logic import sponsor
    32 from soc.logic import sponsor
    33 from soc.logic.site import id_user
    33 from soc.logic.site import id_user
       
    34 from soc.views import helpers
       
    35 import soc.views.helpers.request
    34 from soc.views import simple
    36 from soc.views import simple
    35 from soc.views.helpers import custom_widgets
    37 from soc.views.helpers import custom_widgets
    36 from soc.views.helpers import forms_helpers
    38 from soc.views.helpers import forms_helpers
    37 from soc.views.helpers import response_helpers
    39 from soc.views.helpers import response_helpers
    38 from soc.views.helpers import request_helpers
       
    39 from soc.views.user import profile
    40 from soc.views.user import profile
    40 
    41 
    41 import soc.models.sponsor
    42 import soc.models.sponsor
    42 
    43 
    43 
    44 
   156   else: # request.method == 'GET'
   157   else: # request.method == 'GET'
   157     if existing_sponsor:
   158     if existing_sponsor:
   158       # is 'Profile saved' parameter present, but referrer was not ourself?
   159       # is 'Profile saved' parameter present, but referrer was not ourself?
   159       # (e.g. someone bookmarked the GET that followed the POST submit) 
   160       # (e.g. someone bookmarked the GET that followed the POST submit) 
   160       if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   161       if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   161           and (not request_helpers.isReferrerSelf(request, suffix=linkname))):
   162           and (not helpers.request.isReferrerSelf(request, suffix=linkname))):
   162         # redirect to aggressively remove 'Profile saved' query parameter
   163         # redirect to aggressively remove 'Profile saved' query parameter
   163         return http.HttpResponseRedirect(request.path)
   164         return http.HttpResponseRedirect(request.path)
   164       
   165       
   165       # referrer was us, so select which submit message to display
   166       # referrer was us, so select which submit message to display
   166       # (may display no message if ?s=0 parameter is not present)
   167       # (may display no message if ?s=0 parameter is not present)
   167       context['submit_message'] = (
   168       context['submit_message'] = (
   168           request_helpers.getSingleIndexedParamValue(
   169           helpers.request.getSingleIndexedParamValue(
   169               request, profile.SUBMIT_MSG_PARAM_NAME,
   170               request, profile.SUBMIT_MSG_PARAM_NAME,
   170               values=profile.SUBMIT_MESSAGES))    
   171               values=profile.SUBMIT_MESSAGES))    
   171               
   172               
   172       # populate form with the existing Sponsor entity
   173       # populate form with the existing Sponsor entity
   173       sponsor_form = EditForm(instance=existing_sponsor)
   174       sponsor_form = EditForm(instance=existing_sponsor)