我怎样才能将权限类应用于详细路径?
class EventViewSet(viewsets.ModelViewSet):
@detail_route(methods=['post'])
def messages(self, request, pk=None):
### Check a permissions class.
...
Run Code Online (Sandbox Code Playgroud) 当我的Bootstrap模态显示时,它看起来像是在黑色背景后面.单击屏幕上的任意位置会导致模态消失.
这个问题似乎是由我的导航栏定位造成的 - 删除position: absolute;或position: relative;修复它.不幸的是,由于我需要在导航栏上使用z-index,我无法摆脱定位.
为什么导航栏的位置导致模态被遮挡?有没有办法让模态出现在背景前面,同时保持导航栏上的定位?
既然CloudFront 支持POST请求,是否可以直接向CloudFront进行基于浏览器的上传?
安装时pytest-xdist,我收到此错误:
Collecting pytest-xdist>=1.15.0
Downloading https://company.com/pypi/packages/dc/b2/a59db3ef996b93c3ef35dbbc33557a71ef67a6839d94a52c88eeb1086002/pytest-xdist-1.15.0.tar.gz (87kB)
100% |????????????????????????????????| 92kB 70.2MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-vyEgO5/pytest-xdist/setup.py", line 37, in <module>
'Programming Language :: Python :: 3',
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/home/company/package_name/env/local/lib/python2.7/site-packages/setuptools/dist.py", line 318, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/home/company/package_name/env/local/lib/python2.7/site-packages/setuptools/dist.py", line 376, in finalize_options
ep.load()(self, ep.name, value)
File "build/bdist.linux-x86_64/egg/setuptools_scm/integration.py", line …Run Code Online (Sandbox Code Playgroud) 我有一个MultiPolygon字段,preferences.locations和一个Point字段rental.location.在查询是否包含租赁位置时preferences.locations,只有rental.location在preferences.locationsMultiPolygon中的第一个多边形包含查询时,查询才会成功.
例如,使用以下几何:
point1 = (81.20141954209073, -129.891357421875)
point2 = (40.70875101828792, -73.93179774284363)
preferences.locations = MultiPolygon(
Polygon(((81.14748070499664, -163.289794921875),
point1, # contains the first point
(81.14748070499664, -163.289794921875),
(81.14748070499664, -163.289794921875),)),
Polygon(((40.70718949655447, -73.98123621940613),
point2, # contains the second point
(40.683762276904055, -73.99702906608582),
(40.70718949655447, -73.98123621940613),)),
)
rental1.location = Point(*point1)
rental2.location = Point(*point2)
Run Code Online (Sandbox Code Playgroud)
当查询以查看包含哪些租赁位置时preferences.locations,应返回两个租赁,仅返回第一个租赁.
>>> Rental.objects.filter(location__contained=preferences.locations)
[<Rental: Rental object>] # rental1
Run Code Online (Sandbox Code Playgroud)
如何成功检查哪些租赁位置包含preferences.locations(无论它们包含哪个Polygon).