本文整理匯總了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})