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


Python Status.tech方法代码示例

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


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

示例1: save_status

# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import tech [as 别名]
def save_status(request):
	id = request.POST['id']
	report = Report.objects.get(id=id)
	message = request.POST['message']
	note = request.POST['note']
	user = request.user
	new_status = Status()
	new_status.tech = user
	new_status.report = report
	new_status.message = message
	new_status.note = note
	new_status.save()

	if message == 'p':
		report.completed = True
		report.save()

	return HttpResponseRedirect('/reports/' + id)
开发者ID:BobNisco,项目名称:fall-2012-hackathon,代码行数:20,代码来源:views.py

示例2: cpanel_submit

# 需要导入模块: from models import Status [as 别名]
# 或者: from models.Status import tech [as 别名]
def cpanel_submit(request):
	# The user adding the request
	user = request.user

	name = request.POST['name']
	phone = request.POST['phone']
	email = request.POST['email']
	type = request.POST['device']
	os = request.POST['os']
	problem = request.POST['problem']
	description = request.POST['description']
	deviceObj = Device()
	report = Report()
	usersWithSameEmail = User.objects.filter(email=email)
	reportUser = User()

	userFound = False
	for u in usersWithSameEmail:
		# If user exists, don't create a new one
		if u.email == email:
			reportUser = u
			userFound = True

	if not userFound:
		reportUser.email = email
		reportUser.username = name
		reportUser.password = 'password'
		reportUser.save()

	# Get the devices the user has
	usersDevices = Device.objects.filter(owner=reportUser)

	deviceFound = False
	for d in usersDevices:
		# If the device exists recognize it, and use it
		if d.os == os and d.type == type:
			deviceObj = d
			deviceFound = True

	if not deviceFound:
		# Generate device object
		deviceObj.owner = reportUser
		deviceObj.os = os
		deviceObj.type = type
		deviceObj.save()

	# Generate Report
	report.owner = reportUser
	report.device = deviceObj
	report.description = description
	report.problem = problem
	report.completed = False
	report.save()

	# Generate initial status
	status = Status()
	status.report = report
	# Checked in message
	status.message = 'c'
	status.tech = user
	status.save()

	return cpanel(request, True)
开发者ID:BobNisco,项目名称:fall-2012-hackathon,代码行数:65,代码来源:views.py


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