当前位置: 首页>>代码示例>>Python>>正文


Python Dajax.assign方法代码示例

本文整理汇总了Python中apps.dajax.core.Dajax.assign方法的典型用法代码示例。如果您正苦于以下问题:Python Dajax.assign方法的具体用法?Python Dajax.assign怎么用?Python Dajax.assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.dajax.core.Dajax的用法示例。


在下文中一共展示了Dajax.assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_shipping_rate

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def get_shipping_rate(request,weight,unit):
	dajax = Dajax()
	print "inside the Sales tax"

	dajax.assign('#shipping_rate', 'value', '')

	if weight and unit:
		if unit == 'GM':
			weight = float(weight)/1000

		price = 0.0
		try:
			sr = ShippingCharges.objects.filter(min_weight__lte=float(weight),max_weight__gte=float(weight)).order_by('-id')[0]
			price = sr.amount
		except:
			sr = ShippingCharges.objects.filter(min_weight__lte=float(weight),is_infinite=True).order_by('-id')[0]
			price = sr.amount

		shipping_rate = float(weight)*float(price)

		default_rate = float(SiteConfigurations.objects.get().shipping_charge_default)

		print "Default####",default_rate

		if shipping_rate < default_rate:
			shipping_rate = default_rate

		print "Shipping ######",shipping_rate

		dajax.assign('#shipping_rate', 'value','{0}'.format(format(shipping_rate,'.2f')))
		dajax.script('Calculation();')
	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:34,代码来源:ajax.py

示例2: delete_product

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def delete_product(request,pid):
	dajax = Dajax()

	if pid:
		product = Product.objects.get(id=int(pid))
		name = product.name

		if request.user.user_type == 'A':
			product.delete()
		else:
			product.is_delete = True
			product.save()

			history = ProductHistory()
			history.product = product
			history.person = request.user
			history.act_type = 'DL'
			history.description = "Delete product"
			history.save()


		dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
		dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been deleted successfully .'.format(name))
		dajax.script("Success();")

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:28,代码来源:ajax.py

示例3: check_mail

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def check_mail(request,check_email=None):
	dajax = Dajax()
	if User.objects.filter(email=check_email) or  User.objects.filter(username=check_email):

		print "already exist^^^^^^"
		dajax.assign('#username-status', 'innerHTML', '''<p  style=" margin-top: -8px; color: red;  ">*E-Mail Already Exist, Choose another one !</p>''')
	else:
		dajax.assign('#username-status', 'innerHTML', '''<p  style=" margin-top: -8px; color: green; ">*E-Mail Id Does not Exist</p>''')

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:12,代码来源:ajax.py

示例4: get_discount

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def get_discount(request,product):
	dajax = Dajax()

	product = get_object_or_404(Product, id=int(product))

	dajax.assign('#discount_rows', 'innerHTML', '')

	discounts = product.discount.all().order_by('-id')

	if discounts:
		for counter,discount in enumerate(discounts):

			if discount.is_active():
				dajax.append('#discount_rows', 'innerHTML','''
					<tr id="dis{5}">
						<td>{0}</td>
						<td>{1}</td>
						<td>{2}%</td>
						<td>{3}</td>

						<td>{4}</td>

						<td><a class="btn btn-success btn-icon btn-circle"><i class="fa fa-check"></i></a></td>

						<td>
							<button type="button" onclick="DeleteDiscount({5});" class="btn btn-sm btn-warning"><i class="fa fa-trash"></i> Delete</button>
						</td>
					</tr>

					'''.format(counter+1,discount.name,discount.discount,discount.effe_date.strftime("%d %b %Y"),discount.expi_date.strftime("%d %b %Y"),discount.id))
			else:
				dajax.append('#discount_rows', 'innerHTML','''
					<tr id="dis{5}">
						<td>{0}</td>
						<td>{1}</td>
						<td>{2}%</td>
						<td>{3}</td>

						<td>{4}</td>

						<td><a class="btn btn-danger btn-icon btn-circle"><i class="fa fa-times"></i></a></td>

						<td>
							<button type="button" onclick="DeleteDiscount({5});" class="btn btn-sm btn-warning"><i class="fa fa-trash"></i> Delete</button>
						</td>
					</tr>

					'''.format(counter+1,discount.name,discount.discount,discount.effe_date.strftime("%d %b %Y"),discount.expi_date.strftime("%d %b %Y"),discount.id))

		dajax.script('ShowDiscountTable();')

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:54,代码来源:ajax.py

示例5: check_upc

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def check_upc(request,pid,upc):
	dajax = Dajax()

	print "Check UPC"

	if pid:

		if Product.objects.filter(upc=upc).exclude(id=pid):
			dajax.assign('#upc_alert', 'innerHTML',''' <span class="label label-warning">Warning</span> Product UPC Already Exist, Choose another one !''')
		else:
			dajax.assign('#upc_alert', 'innerHTML',''' <span class="label label-success">Success</span> Product UPC Does not Exist.''')

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:15,代码来源:ajax.py

示例6: add_category

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def add_category(request,name,lang):
	dajax = Dajax()

	print "Inside Add Category",lang,name
	if name:
		node = Category()

		try:
			if lang == 'zh':
				print "Chinese"
				node.name = name
				node.name_zh = name
			else:
				print "English"
				node.name = name

			node.save()
			print "Save"

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been added successfully .'.format(name))
			dajax.script("Success();")
		except:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "The Category <b> {0} </b> already exist".format(name))
			dajax.script("Warning();")

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:30,代码来源:ajax.py

示例7: remove_phone

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def remove_phone(request, customer_id=None, phone_id=None):
    dajax = Dajax()
    dajax.assign("#message1", "innerHTML", "")
    if request.user.is_authenticated:
        if customer_id:
            customer = Customer.objects.get(id=customer_id)
            if customer:
                phone = PhoneNumber.objects.get(id=phone_id)
                phone.delete()
                dajax.assign(
                    "#message1",
                    "innerHTML",
                    """ <div class="alert alert-success"> Successfully Removed customer {0} PhoneNumber<div>""".format(
                        customer.name
                    ),
                )
                dajax.script("LocationReload();")
            else:
                dajax.assign(
                    "#message1", "innerHTML", """<div class="alert alert-danger"> No permission </div></div>"""
                )
        else:
            dajax.assign("#message1", "innerHTML", """ <div class="alert alert-danger"> No permission </div></div>""")

    return dajax.json()
开发者ID:renjithsraj,项目名称:management,代码行数:27,代码来源:ajax.py

示例8: delete_tax

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def delete_tax(request,tid):
	dajax = Dajax()

	print "Delete Sale Taxes"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if tid:

			sale_tax = SaleTax.objects.get(id=tid)

			state = sale_tax.state

			sale_tax.delete()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The state <b> {0} </b> has been deleted successfully .'.format(state))
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:28,代码来源:ajax.py

示例9: add_subcategory

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def add_subcategory(request,cid,name,lang):
	dajax = Dajax()

	print "Inside Add SubCategory"
	if cid:
		cate = Category.objects.get(id=cid)
		node = Category()
		node.parent = cate

		print "Parent Category",cate

		try:
			
			if lang == 'zh':
				print "Chinese"
				node.name = name
				node.name_zh = name
			else:
				print "English"
				node.name = name
			node.save()

			print "Save"

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been added successfully .'.format(name))
			dajax.script("Success();")

		except Exception, e:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")
开发者ID:renjithsraj,项目名称:testcode,代码行数:34,代码来源:ajax.py

示例10: general_settings

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def general_settings(request,short_limit,site_name,image_count,exchange_rate,duty_rate_factor,shipping_charge_default,margin_charge_default):
	dajax = Dajax()

	print "General settings Save - Solo Models"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		print "hai"

		if site_name and int(image_count) and int(short_limit) and float(exchange_rate) and float(duty_rate_factor) and float(shipping_charge_default) and float(margin_charge_default):

			site_settings = SiteConfigurations.objects.get()

			site_settings.site_name = site_name
			site_settings.image_count = int(image_count)
			site_settings.duty_rate_factor = duty_rate_factor
			site_settings.exchange_rate = exchange_rate
			site_settings.shipping_charge_default = shipping_charge_default
			site_settings.margin_charge_default = margin_charge_default
			site_settings.short_limit = short_limit

			site_settings.save()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The site global settings has been updated successfully .')
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:36,代码来源:ajax.py

示例11: edit_sales_tax

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def edit_sales_tax(request,tid,state,tax):
	dajax = Dajax()

	print "Edit Sale Taxes"

	if isinstance(request.user,Staff) and request.user.user_type == 'A':

		if tid and state and float(tax):

			sale_tax = SaleTax.objects.get(id=tid)

			print sale_tax,tid,state,float(tax)

			sale_tax.state = state
			sale_tax.tax_amount = float(tax)
			sale_tax.save()

			dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
			dajax.assign('#success-body', 'innerHTML', 'The state <b> {0} </b> has been updated successfully .'.format(sale_tax.state))
			dajax.script("Success();")
		
		else:
			dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
			dajax.assign('#warning-body', 'innerHTML', "We're sorry, but something went wrong. Please be sure that you entered a valid form.")
			dajax.script("Warning();")

			
	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:30,代码来源:ajax.py

示例12: edit_slider_content

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def edit_slider_content(request,lang,sid=None,title=None,caption=None,url=None,priority=None):
    dajax = Dajax()
    if isinstance(request.user,Staff) and request.user.user_type == 'A':
        try:
            slider = Slider.objects.get(id=sid)
            if title and caption and priority:

                if lang == 'zh':
                    slider.title_zh  = title
                    slider.captions_zh  = caption
                else:
                    slider.title  = title
                    slider.captions  = caption

                slider.url  = url
                slider.priority  = priority

                slider.save()

                dajax.assign('#success-head', 'innerHTML', '<strong>Success!</strong>')
                dajax.assign('#success-body', 'innerHTML', 'The <b> {0} </b> has been edited successfully .'.format(slider.title))

                dajax.script("HIDEmodal();")
                # dajax.script("Success();")
            else:
                dajax.assign('#warning-head', 'innerHTML', '<strong>Warning!</strong>')
                dajax.assign('#warning-body', 'innerHTML', 'Something went wrong')
                # dajax.script("Warning();")
                dajax.script("HIDEWmodal();")
        except Slider.DoesNotExist:
            pass
    else:
        return HttpResponseRedirect(reverse('login'))
    return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:36,代码来源:ajax.py

示例13: get_sales_tax

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def get_sales_tax(request,state):
	dajax = Dajax()
	print "inside the Sales tax"
	dajax.assign('#sales_tax', 'value', '')

	if state:
		sales_tax = SaleTax.objects.get(id=int(state))

		print sales_tax.tax_amount

		dajax.assign('#sales_tax', 'value','{0}'.format(format(sales_tax.tax_amount,'.2f')))

		dajax.script('Calculation();')

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:17,代码来源:ajax.py

示例14: check_remaining_count

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def check_remaining_count(request,pid):
	dajax = Dajax()

	print "Check Remaining Image count when uploading from jfu"

	if pid:

		product = Product.objects.get(id=pid)


		if SiteConfigurations.objects.get().image_count:
			remaining_count = int(SiteConfigurations.objects.get().image_count) - product.image_count()
		else:
			remaining_count = settings.IMAGE_COUNT - product.image_count()

		dajax.assign('#rem_count', 'innerHTML','''{0}'''.format(remaining_count))

	return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:20,代码来源:ajax.py

示例15: add_to_downloadpopup

# 需要导入模块: from apps.dajax.core import Dajax [as 别名]
# 或者: from apps.dajax.core.Dajax import assign [as 别名]
def add_to_downloadpopup(request):
	print "inside add_to_downloadpopup ^^^^^^^^^^^^^^^^^"

	dajax = Dajax()

	if isinstance(request.user,Reseller) and request.user.user_type == 'R':

		dajax.assign('#download-items', 'innerHTML', '')

		if 'download' in request.session:

			print "inside the Add to Popup"

			download_list = request.session['download']

			print "Download List###########",download_list

			if download_list:
				dajax.assign('#download-count', 'innerHTML',
						 '''<span class="download_count download_delay_hover circle">{0}</span>'''.format(len(download_list)))
				
				for download_item in download_list:

					product = Product.objects.get(id=int(download_item['id']))

					dajax.append('#download-items','innerHTML', '''
						<tr id="downid_{5}" class="downloadItemsRow" >
							<td class="downloaded_pro_name">
								<div class="downloaded_thumb"><a href="/product-detail/{2}"><img src="{0}"
								alt="{1}" class=""></a></div>
							</td>

							<td class="downloaded_pro_name">
								<a href="javascript:;" alt="download"><span>{1}</span></a>
								<label class="item_upc_code"><a href="/product-detail/{2}" alt="item_upc_code"><span>{3}</span></a><label>
							</td>

							<td class="downloaded_pro_name">
								<a href="javascript:;" alt="download"><span>{4}</span></a>
							</td>
							<td class="downloaded_pro_name">
								<span style="cursor:pointer" onclick="RemoveDownload_Item({5})" title="Remove"><i class="fa fa-remove"> Remove</i></span>
							</td>
						</tr>'''.format(product.prod_f_photo()[0], product.name, product.slug, product.upc, format(product.network_price,'.2f'),product.id))
			else:
				dajax.assign('#download-count', 'innerHTML',
						 '''<span class="download_count download_delay_hover circle">{0}</span>'''.format(len(download_list)))
				dajax.assign(
					'#download-items', 'innerHTML', '''<tr class="" >
							<td class="downloaded_pro_name">
								<a href="" alt="download"><span>Currently no items for downloading..!</span></a>
							</td> </tr>''')

		return dajax.json()
开发者ID:renjithsraj,项目名称:testcode,代码行数:56,代码来源:ajax.py


注:本文中的apps.dajax.core.Dajax.assign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。