Skip to content

Commit

Permalink
Merge 3a2136e into 059f171
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick committed Jul 27, 2018
2 parents 059f171 + 3a2136e commit e69a0fc
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions docs/widget.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,33 @@ It embeds *Leaflet.draw* in version *0.4.0*.
.. image :: https://f.cloud.github.com/assets/546692/1048836/78b6ad94-1094-11e3-86d8-c3e88626a31d.png
In Adminsite
------------
In admin.py
-----------

::

from django.contrib import admin
from leaflet.admin import LeafletGeoAdmin

from .models import WeatherStation
from .models import WeatherSensor


# A Basic Example
admin.site.register(WeatherStation, LeafletGeoAdmin)

"""A More Complicated Example
Notice ModelAdmin(admin.ModelAdmin) also has to change to modelAdmin(LeafletGeoAdmin)
@admin.register() decorator not required for Django-Leaflet, but is for inlines.
"""
class WeatherSensorInline(admin.TabularInline):
model = WeatherSensor
fields = ['manufacturer, 'model', 'sensor_type']
@admin.register(WeatherSensor)
class WeatherSensorAdmin(LeafletGeoAdmin)
model = WeatherSensor
inlines = [WeatherSensorInline,]


A mixin is also available for inline forms:

Expand All @@ -33,8 +47,8 @@ A mixin is also available for inline forms:
model = PoiLocation


In forms
--------
In forms.py
-----------

With *Django* >= 1.6:

Expand Down

0 comments on commit e69a0fc

Please sign in to comment.