本文整理汇总了Python中models.ProfileForm类的典型用法代码示例。如果您正苦于以下问题:Python ProfileForm类的具体用法?Python ProfileForm怎么用?Python ProfileForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProfileForm类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:jerrayl,项目名称:DHTribes-source,代码行数:9,代码来源:activity.py
示例2: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
# https://cloud.google.com/appengine/docs/python/tools/protorpc/messages/messageclass#all_fields
for field in pf.all_fields():
if hasattr(prof, field.name):
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:nickyfoto,项目名称:Endpoints,代码行数:10,代码来源:reader.py
示例3: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:Taiyi,项目名称:Conference,代码行数:11,代码来源:conference.py
示例4: _copyProfileToForm
def _copyProfileToForm(self, prof):
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:aguijarro,项目名称:conference,代码行数:12,代码来源:conference.py
示例5: toProfileForm
def toProfileForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == "teeShirtSize":
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:arizonatribe,项目名称:app-engine-demo,代码行数:12,代码来源:mapper.py
示例6: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
logging.debug("Did run _copyProfileToForm()")
return pf
开发者ID:GoogleCloudPlatformTraining,项目名称:cpd200-conference-central-python,代码行数:14,代码来源:REF_10_conference.py
示例7: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name) and not field.name == 'conferenceKeysToAttend':
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:AdamVanOijen,项目名称:Project-4,代码行数:14,代码来源:conference.py
示例8: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
elif field.name == 'sessionWishlist':
setattr(pf, field.name, [k.urlsafe() for k in getattr(prof, field.name)])
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:emonica,项目名称:conference_central,代码行数:15,代码来源:conference.py
示例9: _copyProfileToForm
def _copyProfileToForm(self, profile):
"""Copy relevant fields from Profile to ProfileForm."""
profileForm = ProfileForm()
for field in profileForm.all_fields():
if hasattr(profile, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr( profileForm,
field.name,
getattr(TeeShirtSize, getattr(profile, field.name)) )
else:
setattr( profileForm,
field.name,
getattr(profile, field.name) )
profileForm.check_initialized()
return profileForm
开发者ID:TsubasaK111,项目名称:MeetingMaster,代码行数:16,代码来源:conference.py
示例10: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
print pf
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
# getattr(object, name[, default]):Return the value of the named attr. or default
# setattr(object, name, value)
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:zhangtreefish,项目名称:google-app-engine-project,代码行数:16,代码来源:conference.py
示例11: edit
def edit(request):
user=users.GetCurrentUser()
if user is None:
return http.HttpResponseForbidden('You must be signed in to add or edit a greeting')
profile=Profile.gql("where user=:1",user).get()
form = ProfileForm(data=request.POST or None, instance=profile)
if not request.POST:
return views.respond(request, user, 'profiles/form', {'form': form, 'current_profile': profile})
errors = form.errors
if not errors:
try:
profile = form.save(commit=False)
except ValueError, err:
errors['__all__'] = unicode(err)
开发者ID:oloed,项目名称:talk.org,代码行数:16,代码来源:profiles.py
示例12: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
elif (field.name == 'sessionKeysToAttend' or field.name == 'conferenceKeysToAttend'):
new_list = [item.get().key.urlsafe() for item in getattr(prof, field.name)]
setattr(pf, field.name, new_list)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:Morenito88,项目名称:full_stack_p4,代码行数:16,代码来源:conference.py
示例13: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == "teeShirtSize":
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
if field.name == "websafeSessionKeysWishlist":
sessionKeysWishlist = getattr(prof, "sessionKeysWishlist")
websafeSessionKeysWishlist = [k.urlsafe() for k in websafeSessionKeysWishlist]
setattr(pf, field.name, websafeSessionKeysWishlist)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:g7845123,项目名称:conference-central,代码行数:17,代码来源:conference.py
示例14: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(
TeeShirtSize, getattr(prof, field.name)))
elif field.name == "sessionKeysWishlist":
all_keys = []
for each_key in prof.sessionKeysWishlist:
all_keys.append(each_key.urlsafe())
setattr(pf, field.name, all_keys)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:powebdev,项目名称:p4_conference,代码行数:19,代码来源:conference.py
示例15: _copyProfileToForm
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert key objects to websafekey, put it back in a list
if field.name.endswith('Attend'):
key_list = [x.urlsafe() for x in getattr(prof, field.name)]
setattr(pf, field.name, key_list)
# convert t-shirt string to Enum;
elif field.name == 'teeShirtSize':
setattr(pf, field.name,
getattr(TeeShirtSize, getattr(prof, field.name)))
# just copy others
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
开发者ID:wiseleywu,项目名称:Conference-Central-API,代码行数:19,代码来源:conference.py
示例16: editProfile
def editProfile(request):
title="Edit Profile"
if request.method == 'POST':
userform = ProfileForm(request.POST) # A form bound to the POST data
adressform = AdressForm(request.POST)
if userform.is_valid(): # All validation rules pass
oldpassword = userform.cleaned_data['oldpassword']
password = userform.cleaned_data['password']
secpassword = userform.cleaned_data['secpassword']
email = userform.cleaned_data['email']
if adressform.is_valid():
publicadress = adressform.cleaned_data['publicAdress']
country = adressform.cleaned_data['country']
city = adressform.cleaned_data['city']
zipcode = adressform.cleaned_data['zipcode']
street = adressform.cleaned_data['street']
housenumber = adressform.cleaned_data['housenumber']
userprofile = request.user.profile
l = Location(country=country, city=city, zipcode=zipcode, street=street, housenumber=housenumber)
l.save()
userprofile.adress = l
userprofile.publicAdress = publicadress
userprofile.save()
else:
user = request.user
try:
userform = ProfileForm({'email': user.email,})
except:
userform = UserForm()
try:
adressform = AdressForm({
'publicAdress': user.profile.publicAdress,
'country': user.profile.adress.country,
'city': user.profile.adress.city,
'zipcode': user.profile.adress.zipcode,
'street': user.profile.adress.street,
'housenumber': user.profile.adress.housenumber})
except:
adressform = AdressForm()
context = util.generateContext(request, contextType = 'RequestContext', userform=userform, adressform=adressform, title=title)
return render_to_response('usermanag/edit.html', context)
开发者ID:miri64,项目名称:share_datalove,代码行数:42,代码来源:views.py
示例17: editProfileMethod
def editProfileMethod(request):
try:
fields = ProfileForm.all_fields()
profileId = ndb.Key(urlsafe=getattr(request, 'profileId'))
profile = profileId.get()
for field in fields:
value = getattr(request, field.name, None)
if field.name == 'collegeId':
continue
if value is None or value == "" or value == []:
continue
setattr(profile, field.name, value)
profile.put()
return Response(response=0, description="OK")
except Exception, E:
return Response(response=1, description=str(E))
开发者ID:Flap-Py,项目名称:NotesCC,代码行数:16,代码来源:editMethods.py
注:本文中的models.ProfileForm类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论