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


Python Subscription.getActiveByIp方法代码示例

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


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

示例1: get

# 需要导入模块: from subscription.models import Subscription [as 别名]
# 或者: from subscription.models.Subscription import getActiveByIp [as 别名]
 def get(self, request):
     partnerId=request.GET.get("partnerId")
     ipAddress=request.GET.get("ipAddress")
     userIdentifier=request.GET.get("userIdentifier")
     expDate = ""
     subscribed = False
     sub = Subscription.getActiveByIp(ipAddress, partnerId)
     if len(sub)==0:
         if Credential.objects.filter(userIdentifier=userIdentifier).filter(partnerId=partnerId).exists():
             partyId = Credential.objects.filter(userIdentifier=userIdentifier)[0].partyId.partyId
             sub = Subscription.getActiveById(partyId, partnerId)
     if len(sub)>0:
         expDate = SubscriptionSerializer(sub[0]).data['endDate']
         subscribed = True
     return HttpResponse(json.dumps({'expDate':expDate, 'subscribed':subscribed}), content_type="application/json")
开发者ID:ahlfors,项目名称:api-python,代码行数:17,代码来源:views.py

示例2: get

# 需要导入模块: from subscription.models import Subscription [as 别名]
# 或者: from subscription.models.Subscription import getActiveByIp [as 别名]
 def get(self,request):
     params = request.GET
     partnerId = params['partnerId']
     ipAddress = params['ipAddress']
     userIdentifier = params['userIdentifier']
     idSub = None #Pw-418
     subList = [] #Pw-418
     ipSub = Subscription.getActiveByIp(ipAddress, partnerId)
     if Credential.objects.filter(userIdentifier=userIdentifier).filter(partnerId=partnerId).exists():
         partyId = Credential.objects.filter(partnerId=partnerId).filter(userIdentifier=userIdentifier)[0].partyId.partyId
         idSub = Subscription.getActiveById(partyId, partnerId)
     if (idSub):
         subList = SubscriptionSerializer(ipSub, many=True).data+SubscriptionSerializer(idSub, many=True).data
     else:
         subList = SubscriptionSerializer(ipSub, many=True).data
     for sub in subList:
         if Party.objects.filter(partyId = sub['partyId']).exists():
             party = PartySerializer(Party.objects.get(partyId = sub['partyId'])).data
             sub['partyType'] = party['partyType']
             sub['name'] = party['name']
     return HttpResponse(json.dumps(subList), content_type="application/json")
开发者ID:tair,项目名称:api-python,代码行数:23,代码来源:views.py

示例3: hasActiveSubscription

# 需要导入模块: from subscription.models import Subscription [as 别名]
# 或者: from subscription.models.Subscription import getActiveByIp [as 别名]
 def hasActiveSubscription(ip, partyId, partnerId):
     if partyId and partyId.isdigit() and len(Subscription.getActiveById(partyId, partnerId)) > 0:
         return True
     if ip and len(Subscription.getActiveByIp(ip, partnerId)) > 0:
         return True
     return False
开发者ID:ahlfors,项目名称:api-python,代码行数:8,代码来源:controls.py


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