当前位置: 首页>>代码示例>>Python>>正文


Python Activity.club方法代码示例

本文整理汇总了Python中models.Activity.club方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.club方法的具体用法?Python Activity.club怎么用?Python Activity.club使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Activity的用法示例。


在下文中一共展示了Activity.club方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createNewActivity

# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import club [as 别名]
def createNewActivity(request):
	title = request.POST['title']
	host = request.POST['host']
	undertake = request.POST['undertake']
	time = request.POST['time']
	area = request.POST['area']
	place = request.POST['place']
	tel = request.POST['tel']
	email = request.POST['email']
	brief = request.POST['brief']
	detail = request.POST['detail']
	number = int(request.POST['number'])
	c_id = request.POST['c_id']

	club = Club.objects.get(id=c_id)

	today = str(date.today().year)+'-'+str(date.today().month)+'-'+str(date.today().day)

	#basic information
	information = activityInfo()
	information.title = title
	information.host = host
	information.undertake = undertake
	information.time = time
	information.area = area
	information.place = place
	information.tel = tel
	information.email = email
	information.number = number
	information.save()

	#host club
	host = hostClub()
	host.HC_club = club
	host.save()

	#record
	record = recordInfo()
	record.save()

	#create new activity
	new_activity = Activity()
	new_activity.information = information
	new_activity.club = host
	new_activity.school = club.school
	new_activity.record = record
	new_activity.brief_intro = brief
	new_activity.detail_intro = detail

	form = uploadFileForm(request.POST, request.FILES)
	if form.is_valid():
		new_activity.image = request.FILES['image']
		new_activity.safe_file = request.FILES['safe_file']

	new_activity.save()

	createGlobalNews(club.id,new_activity.id,'3')

	return HttpResponse('1')
开发者ID:lqchn,项目名称:lqchn,代码行数:61,代码来源:views.py


注:本文中的models.Activity.club方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。