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


Python Client.save方法代码示例

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


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

示例1: create

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
 def create(self, validated_data):
     client = Client(
         name=validated_data['name'],
         alias=validated_data['name'].lower(),
         active=validated_data['active']
     )
     client.save()
     return client
开发者ID:rodolfogamd,项目名称:my-agenda,代码行数:10,代码来源:serializers.py

示例2: test_parse_client

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
    def test_parse_client(self):

        response = '''
            {"response":[{"id":"107111","name":"Ford","day_limit":170,"all_limit":3000}]}
            '''
        account = AccountFactory(remote_id=1)
        instance = Client(account=account, fetched=datetime.now())
        instance.parse(json.loads(response)['response'][0])
        instance.save(commit_remote=False)

        self.assertEqual(instance.account, account)
        self.assertEqual(instance.remote_id, 107111)
        self.assertEqual(instance.name, 'Ford')
        self.assertEqual(instance.day_limit, 170)
        self.assertEqual(instance.all_limit, 3000)
开发者ID:Nikitin,项目名称:django-vkontakte-ads,代码行数:17,代码来源:tests.py

示例3: clients_add

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def clients_add(request):
    if request.method == "POST":
        add_form = ClientAddForm(request.POST)
        if add_form.is_valid():
            new_cl = Client(
                name=add_form.cleaned_data["name"],
                address=add_form.cleaned_data["address"],
                zip_code=add_form.cleaned_data["zip_code"],
                country=add_form.cleaned_data["country"],
            )
            new_cl.save()
            return HttpResponseRedirect("/clients/")
    else:
        add_form = ClientAddForm()
    return render_to_response("storage/clients_add.html", {"form": add_form}, context_instance=RequestContext(request))
开发者ID:waso,项目名称:pwarehouse,代码行数:17,代码来源:views.py

示例4: createUser

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def createUser(request):
    _udid = request.GET['udid']
    _tokenId = request.GET['tokenId']
    _bundleId = request.GET['bundleId']
    userId = ""
    try : 
        user = Client.objects.get(udid =_udid)
        user.tokenId = _tokenId
        user.bundleId = _bundleId
        userId = user.id
        user.save()
    except :
        add_to_db = Client(udid=_udid,tokenId=_tokenId,bundleId=_bundleId)
        add_to_db.save()
        userId= add_to_db.id
    return JSONResponse({'userId':userId})
开发者ID:jayachandp,项目名称:deal-Notifier,代码行数:18,代码来源:views.py

示例5: post

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
    def post(self):

        client = Client()

        client.nome = request.form.get("nome")
        client.razao_social = request.form.get("razao_social")
        client.rua = request.form.get("rua")
        client.cep = request.form.get("cep")
        client.bairro = request.form.get("bairro")
        client.cidade = request.form.get("cidade")
        client.email = request.form.get("email")
        client.observacao = request.form.get("observacao")

        client.save()

        flash(ClientMessages.CLIENT_ADD_SUCCESS, CssMessages.SUCCESS)
        return redirect(url_for(".ClientAPIForm"))
开发者ID:fabiancabau,项目名称:clientmanager,代码行数:19,代码来源:client.py

示例6: date

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def date(request):
    if request.method == 'POST':
        if request.is_ajax():
            name = request.POST.get('name')
            phone = request.POST.get('phone')
            email = request.POST.get('email')
            d = request.POST.get('date')
            t = request.POST.get('time')
            dd = datetime.date.fromtimestamp(int(d)/1000.0)

            bookedHour = int(t[16:18])
            bookedMin = int(t[19:21])
            bookedTime = datetime.time(bookedHour, bookedMin)
            dateTime = Client(name = name, phone = phone, email = email, date = dd, time=bookedTime)
            dateTime.save()
            return render(request, 'date2.html')

    return render(request,'date2.html')
开发者ID:pkw0818,项目名称:ami2,代码行数:20,代码来源:views.py

示例7: get

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
	def get(self, request):
		data = json.loads(list(request.GET)[0].replace('\'', ''))
		register_output = { 'code': -1 }
		u = authenticate(username=data['name_surname'], password=data['pass'])
		if u is not None:
		 	register_output['code'] = 1
			return JsonResponse(register_output)
		else:
			u = User()
			u.email = data['email']
			u.username = data['name_surname']
			u.set_password(data['pass'])
			register_output['code'] = 0 
			u.save()
			client = Client(client_id=data['client_id'])
			client.save()
			qccess_token = create_token(u, client)
			register_output.update({'token' : access_token.token})
			return JsonResponse(register_output)
开发者ID:alexacristina,项目名称:ipp_lab0,代码行数:21,代码来源:views.py

示例8: login

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def login(request):
	print 'blarg'
	if request.method == 'POST':
		print 'passed check 1'
		if request.POST.__contains__('user') and request.POST.__contains__('sessionid'):
			print 'passed if'
			hash = hashlib.md5(request.POST.__getitem__('sessionid')).hexdigest()
			print 'got hash'
			client = Client(user=request.POST.__getitem__('user'), sessionid=str(request.POST.__getitem__('sessionid')), md5=hash)
			print 'made client'
			
			print 'saved user'
			client.save()
			print 'saved client'
			return HttpResponse(hash)
			
		else:
			return HttpResponse('Invalid Request')
	if request.method == 'GET':
		return HttpResponse('ERROR')
开发者ID:T-Mac,项目名称:MineNet,代码行数:22,代码来源:auth.py

示例9: save_client

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def save_client(request, form):
    cart = CartItem.objects.get(cart_id=_cart_id(request))
    ci = Client()
    ci.cart = cart
    products = CartProduct.objects.filter(cartitem=cart.id)
    order = ""
    for i in products:
        order += u"%s %s - %i шт<br>" % (i.product.series.category, i.product.name, i.quantity)

    ci.name = form.cleaned_data['name']
#    ci.surname = form.cleaned_data['surname']
#    ci.patronymic = form.cleaned_data['patronymic']
    ci.city = form.cleaned_data['city']
#    ci.postcode = form.cleaned_data['postcode']
    ci.phone = form.cleaned_data['phone']
    ci.company = form.cleaned_data['company']
    ci.address = form.cleaned_data['address']
    ci.email = form.cleaned_data['email']
    ci.message = form.cleaned_data['message']
#    ci.subtotal = subtotal_class.subtotal()
#    ci.discount = subtotal_class.discount
    ci.referrer = request.COOKIES.get('REFERRER', None)
    ci.order = order
    ci.save()
开发者ID:wd5,项目名称:smartfreeze,代码行数:26,代码来源:cart.py

示例10: register

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
	def register(self, form):
		user = super(ClientRegistrationView, self).register(form)
		client = Client(user=user)
		client.save()
		return user
开发者ID:MoonChel,项目名称:makeithappen,代码行数:7,代码来源:views.py

示例11: get_and_store

# 需要导入模块: from models import Client [as 别名]
# 或者: from models.Client import save [as 别名]
def get_and_store( request, action = None, val = None ):
    '''
    Triggeres specific API calls to fetch and pupulate Accounts and Campaigns in those accounts
    Use this to populate initial data
    :param request:
    :param action: get_all_account_details, get_all_campaigns 
    :param val: Account 
    '''
    result = {'r':'failed'}
    result['action'] = action
    ai = adwords_utils.Adwords_interactor()

    if action == 'get_all_account_details':
        all_client_details = ai.get_all_account_details()
        for temp_client in all_client_details:
            print temp_client['customerId']
            import pdb; pdb.set_trace()
            try:
                c = Client.objects.get( login = temp_client['login'])
                if c.client_id != temp_client['customerId']:
                    c.client_id = temp_client['customerId']
                    c.name = temp_client['name']
                    c.save()
            except Client.DoesNotExist:
                c = Client( client_id = temp_client['customerId'], name = temp_client['name'], login = temp_client['login'], depth = temp_client['depth'] )
                c.save()
        result['d'] = all_client_details
        result['r'] = 'success'

    elif action == 'get_all_campaigns':
        """
        get all campaigns data
        """
        try:
            temp_client = Client.objects.get( id = val )

            all_campaigns = ai.get_all_campaigns( temp_client.id )
            for temp_campaign in all_campaigns:
                try:
                    c = Campaign.objects.get( name = temp_campaign['name'] )
                    if not c.id:
                        c.id = temp_campaign['id']
                        c.save()
                except Campaign.DoesNotExist: 
                    c = Campaign( client = temp_client,
                                 id = temp_campaign['id'],
                                 name = temp_campaign['name'],
                                 status = temp_campaign['status'],
                                 campaign_stats = temp_campaign['campaignStats'],
                                 frequency_cap = temp_campaign['frequencyCap'],
                                 )
                    c.save()
            result['d'] = all_campaigns
            result['r'] = 'success'

        except Client.DoesNotExist:
            result['d'] = "client doesn't exist"
    elif action == 'gat_':
        pass
    else:
        pass
    return HttpResponse( dumps( result ) )
开发者ID:vivekananda,项目名称:django_adwords,代码行数:64,代码来源:views.py


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