erdem / django-map-widgets

Highly customizable, intuitive, and user-friendly map widgets for GeoDjango applications.
MIT License
450 stars 119 forks source link

GooglePointFieldInlineWidget not working #42

Closed teror4uks closed 6 years ago

teror4uks commented 7 years ago

I want use django-map-widgets in inline style.

class TransportAdminForm(forms.ModelForm):

    class Meta:
        fields = (
            "coordinate",
            "destination",
            'type_transport',
            'date_loading',
            'valid',
            'is_published'
        )
        widgets = {
            'coordinate': GooglePointFieldInlineWidget,
        }

class TransportAdminStackedInline(admin.StackedInline):
    model = Transport
    form = TransportAdminForm
    extra = 0
    # formfield_overrides = {
    #     models.PointField: {"widget": GooglePointFieldInlineWidget}
    # }

@admin.register(Carrier)
class CarrierAdmin(admin.ModelAdmin):
    form = CarrierAdminForm
    list_display = ('company_name', 'is_published')
    list_display_links = ('company_name',)
    list_editable = ('is_published', )
    inlines = [TransportAdminStackedInline]

but it does not works, I get empty map without scrolls, point and opportunity write and change coordinates. It seems like this: image

teror4uks commented 7 years ago

more info: I use django-jet admin, version django-map-widjets 0.1.9. If reload inline page when you stayed there, problem fixed, but If general page contains map to, this general map stoped works like inline.

erdem commented 6 years ago

Thank you for your contribution. @teror4uks

I tested GooglePointFieldInlineWidget with only itself, and it worked. I implemented a Django admin class as like yours, and that worked as well. I didn't reproduce your issue. It might be a conflict with django-jet. Make sure mapwidgets static files copied your STATIC_ROOT after called collecstatic command.