Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 谷歌地图自动完成在Django MultiFormView中不起作用_Python_Django_Google Maps - Fatal编程技术网

Python 谷歌地图自动完成在Django MultiFormView中不起作用

Python 谷歌地图自动完成在Django MultiFormView中不起作用,python,django,google-maps,Python,Django,Google Maps,我正在使用库为属性创建一个地址字段。为了显示表单,我使用以下代码: class PropertyForm(forms.ModelForm): class Meta: model = Property fields = ['address', 'owned_since', 'geolocation', 'bought_for', 'property_type'] widgets = {

我正在使用库为属性创建一个地址字段。为了显示表单,我使用以下代码:

class PropertyForm(forms.ModelForm):

    class Meta:
        model = Property
        fields = ['address', 'owned_since',
                  'geolocation', 'bought_for', 'property_type']
        widgets = {
            'address':  map_widgets.GoogleMapsAddressWidget(attrs={'data-map-type': 'roadmap', 'data-autocomplete-options': json.dumps({
                'componentRestrictions': {'country': 'us'}
            })}),
            'geolocation': forms.HiddenInput(),
            'owned_since': forms.DateInput(attrs={
                'placeholder': 'YYYY-MM-DD'
            }),
            'bought_for': CustomMoneyWidget(attrs={'class': 'form-control'})
        } 
它在一般的UpdateView和管理界面中工作得很好,但是当我尝试将它包含在中时,地图不会显示,AutoMLETE也不会工作,它的行为就像一个简单的CharField。控制台中也没有错误或消息


我在这里遗漏了什么?

我的问题是,当与
MultiFormView
混合时,上下文中的表单名称位于
forms下。您的表单
。解决方案就是在head标签中添加
{{forms.your_form.media}