Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.contrib.gis.db import models as m
- from djgeojson.fields import GeometryCollectionField
- class Doc(m.Model):
- name = m.CharField()
- type = m.ForeignKey()
- geom = GeometryCollectionField()
- class DocAdmin(admin.ModelAdmin):
- form = f.DocGeometryForm
- ...
- class DocGeometryForm(f.ModelForm):
- class Meta:
- model = m.Doc
- widgets = {
- 'geom': LeafletWidget(),
- }
- class Media:
- css = {
- 'all':('ext/leaflet/leaflet.css',)
- }
- js = [
- 'ext/jquery/jquery.js',
- 'ext/leaflet/leaflet.js',
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement