本文整理汇总了Python中misc.dajax.core.Dajax.alert方法的典型用法代码示例。如果您正苦于以下问题:Python Dajax.alert方法的具体用法?Python Dajax.alert怎么用?Python Dajax.alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc.dajax.core.Dajax
的用法示例。
在下文中一共展示了Dajax.alert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_event
# 需要导入模块: from misc.dajax.core import Dajax [as 别名]
# 或者: from misc.dajax.core.Dajax import alert [as 别名]
def update_event(request,form):
dajax = Dajax()
form = UpdateForm(deserialize_form(form))
event_object = request.user.get_profile().event
all_updates = Update.objects.filter(event=event_object)
major_count = 0
update_count = 0
if form.is_valid():
for u in all_updates:
if u.category=='Updates' and u.expired is False:
update_count = update_count + 1
print update_count
elif u.category=='Major Update' and u.expired is False:
major_count = major_count + 1
print major_count
elif update_count>4 and u.category=='Updates':
dajax.alert("This event already has 4 Updates.\
Please mark one update as Expired before adding a new update")
elif major_count>1 and u.category=='Major Update':
dajax.alert("This event already has one Major Update.\
Please mark the Major Update as Expired before adding another one")
#Write to json here
else :
template = loader.get_template('events/home.html')
t = template.render(RequestContext(request,locals()))
return dajax.json()
示例2: hello
# 需要导入模块: from misc.dajax.core import Dajax [as 别名]
# 或者: from misc.dajax.core.Dajax import alert [as 别名]
def hello(request, form=None):
"""
Test dajax
"""
dajax = Dajax()
dajax.alert("got from dajax");
return dajax.json()
示例3: alerter
# 需要导入模块: from misc.dajax.core import Dajax [as 别名]
# 或者: from misc.dajax.core.Dajax import alert [as 别名]
def alerter(request,**kwargs):
print 'sssssssssssssssssss\n\n\n\n\n'
dajax=Dajax()
try:
col=College(name=text1,city=text2,state=text3)
col.save()
#form['college']=col
except:
col=College.objects.get(name=text1)
dajax.alert("Your college is already present")
#return dajax.json()
return simplejson.dumps({'message':'Added your college:: %s'% text1,'col':col})