本文整理汇总了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)
示例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)