从后端(python/Django)在模板上显示确认消息
您好,我有一个从后端(python/Django)在模板上显示确认消息,python,angularjs,django,twitter-bootstrap,Python,Angularjs,Django,Twitter Bootstrap,您好,我有一个JSONResponseMixin视图,该视图的主要功能是在用户在GUI中单击“确认”后将状态更改为“已确认”。我想显示一个弹出窗口,说明已确认。如何从django views.py中执行此操作 以下是我的看法 class ConfirmView(JSONResponseMixin, View): def post(self, request, *args, **kwargs): status = 'error' msg = "this i
JSONResponseMixin视图
,该视图的主要功能是在用户在GUI中单击“确认”后将状态更改为“已确认”。我想显示一个弹出窗口,说明已确认。如何从django views.py中执行此操作
以下是我的看法
class ConfirmView(JSONResponseMixin, View):
def post(self, request, *args, **kwargs):
status = 'error'
msg = "this is from me"
post_body = json.loads(self.request.body)
fab_value = post_body['fab']
mast_value = post_body['mast']
comment = post_body.get('comment')
try:
object = Forecast.objects.get(fab=fab_value, mast=mast_value, type='XC')
except ObjectDoesNotExist:
object = []
else:
if object.status == 'notified(created)' or 'notified(updated)':
object.status = 'confirmed'
object.comment = second_po_comment
object.confirm = self.request.user
object.modified_by =User.objects.get(username=self.request.user.username)
object.save()
return self.render_json_response(dict(status=status, msg=msg))
您已经在向客户端发送
状态
和消息
。用简单的html/css创建一个模式窗口并在其中显示消息怎么样?很好,Alix,但无法在我的项目中创建更多的html文件。您已经在向客户端发送状态
和消息
。用简单的html/css创建一个模式窗口并在其中显示消息怎么样?Alix很好,但是在我的项目中不能再创建html文件了。