本文整理汇总了Python中models.Member.validate_unique方法的典型用法代码示例。如果您正苦于以下问题:Python Member.validate_unique方法的具体用法?Python Member.validate_unique怎么用?Python Member.validate_unique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Member
的用法示例。
在下文中一共展示了Member.validate_unique方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _insert_member
# 需要导入模块: from models import Member [as 别名]
# 或者: from models.Member import validate_unique [as 别名]
def _insert_member(form):
first_name = form.cleaned_data['first_name']
last_name = form.cleaned_data['last_name']
nickname = form.cleaned_data['nickname']
instrument = form.cleaned_data['instrument']
major = form.cleaned_data['instrument']
year_starting_band = form.cleaned_data['year_starting_band']
year_starting_school = form.cleaned_data['year_starting_school']
best_band_memory = form.cleaned_data['best_band_memory']
photo = form.cleaned_data['photo']
m = Member(first_name=first_name, last_name=last_name, nickname=nickname,
instrument=instrument, major=major, year_starting_band=year_starting_band,
year_starting_school=year_starting_school, best_band_memory=best_band_memory)
mPhoto = Member_Photo(photo)
mPhoto.member = m
m.image = mPhoto;
m.validate_unique()
mPhoto.validate_unique()
mPhoto.save()
m.save()
success = 'Added the member "%s" to the system.' % str(m)
return success