本文整理汇总了Python中models.Report.description方法的典型用法代码示例。如果您正苦于以下问题:Python Report.description方法的具体用法?Python Report.description怎么用?Python Report.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Report
的用法示例。
在下文中一共展示了Report.description方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cpanel_submit
# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import description [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)