本文整理汇总了Python中models.Location.goof方法的典型用法代码示例。如果您正苦于以下问题:Python Location.goof方法的具体用法?Python Location.goof怎么用?Python Location.goof使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Location
的用法示例。
在下文中一共展示了Location.goof方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: airport_profile
# 需要导入模块: from models import Location [as 别名]
# 或者: from models.Location import goof [as 别名]
def airport_profile(request, navaid, ident):
from plane.models import Plane
from logbook.models import Flight
from django.contrib.auth.models import User
from django.http import Http404
loc = Location.goof(loc_class__in=(1,2), identifier=ident)
if loc.loc_class == 1 and navaid:
raise Http404
if loc.loc_class == 2 and not navaid:
raise Http404
users = Location.get_profiles(ident, 'identifier')
tailnumbers = Plane.objects\
.exclude(tailnumber="")\
.values_list('tailnumber', flat=True)\
.filter(flight__route__routebase__location__identifier=ident)\
.order_by('tailnumber')\
.distinct()
t_flights = Flight.objects\
.filter(route__routebase__location__identifier=ident)\
.count()
lc = loc.get_loc_class_display().lower()
previous_identifiers = HistoricalIdent.objects\
.filter(current_location=loc)
if navaid:
ty = 'navaid'
else:
ty = 'airport'
kwargs ={'ident': loc.identifier, 'type': ty}
kml_url = reverse("routes_for_location-kml", kwargs=kwargs)
print kml_url
return locals()