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


Python Location.latitude方法代码示例

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


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

示例1: add_location

# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import latitude [as 别名]
def add_location(request, loc_type, map_source ="google-maps", visibility = "private"):
    location = Location(owner = users.get_current_user(), 
                            map_source =map_source, loc_type = loc_type)
    location.visibility = visibility
    
    if loc_type == "extent":
        location.name = request.get('loc-name')
        location.latitude = float(request.get('latitude'))
        location.longitude =float(request.get('longitude'))
        location.zoom = int(request.get('zoom'))
    elif loc_type == "point":
        location.name = request.get('point-name')
        location.latitude = float(request.get('latitude-point'))
        location.longitude =float(request.get('longitude-point'))
        location.zoom = int(request.get('zoom-point'))
    tkn = location.buildToken()
    location.token = tkn
        
    location.put()
    return location.toJSON()
开发者ID:luiscberrocal,项目名称:pygooglemaps,代码行数:22,代码来源:googlemaps.py

示例2: post

# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import latitude [as 别名]
  def post(self, request_id):
    location = self.request.get('location')
    # Get request
    request = ndb.Key(urlsafe=request_id).get()
    location = location.split('^')

    # Check if location has been previously used
    existing_location = Location.query(Location.name == location[0], Location.address == location[1]).get()
    if existing_location is None:
      # Add new location
      categories = location[3].split(',')
      coordinates = location[4].split(' ')
      new_location = Location()
      new_location.name = location[0]
      new_location.address = location[1]
      new_location.image_url = location[2]
      for c in categories:
        new_location.categories.append(c)
      new_location.longitude = float(coordinates[0])
      new_location.latitude = float(coordinates[1])
      new_location.put()
      
    else:
      new_location = existing_location

    if request != None:
      # Check if already appended
      add = True
      if len(request.bidders) > 0:
        for bid in request.bidders:
          bid = bid.get()
          if bid.name == self.user_model.username:
            print "Already bid"
            add = False
      if add is True:
          print "Haven't bid"
          bidder = Bidder()
          bidder.sender = self.user_model.key
          bidder.location = new_location.key
          bidder.name = self.user_model.username
          bidder.bid_time = datetime.datetime.now() - datetime.timedelta(hours=8)
          bidder.price = request.price
          bidder.put()
          request.bidders.append(bidder.key)
          request.status = "pending"
          request.put()
    else:
      print "Already connected"

    self.redirect('/feed')
开发者ID:Qiwis,项目名称:foodie,代码行数:52,代码来源:foodie_requests.py

示例3: addlocation

# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import latitude [as 别名]
def addlocation(request):
    request.session.set_expiry(0)
    
    location = Location()
    location.name = request.POST['name']
    location.locationImg = request.POST['locationImg']
    location.description = request.POST['description']
    location.locationLink = request.POST['locationLink']
    location.longitude = request.POST['longitude']
    location.latitude = request.POST['latitude']
    user_id = request.POST['sel1']
    userUser = User.objects.get(id = user_id)
    user = User_Regular.objects.get(user = userUser)
    location.owner = user
    location.save() 

    return redirect('admin')
开发者ID:dkeske,项目名称:KutijaSajt,代码行数:19,代码来源:views.py


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