The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango.

Overview

Build Status

Django Leaflet Admin List

Screen Example

The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango. It requires a django-leaflet package.

Installation

Stable version from the PyPi package repository

pip install django-leaflet-admin-list

Last development version from the GitHub source version control system

pip install git+git://github.com/nnseva/django-leaflet-admin-list.git

Configuration

Include the leaflet_admin_list application into the INSTALLED_APPS list, like:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    ...
    'leaflet',
    'leaflet_admin_list',
    ...
]

Using

In your admin.py:

...
from leaflet.admin import LeafletGeoAdminMixin
from leaflet_admin_list.admin import LeafletAdminListMixin
...

class WaypointAdmin(LeafletAdminListMixin, LeafletGeoAdminMixin, ModelAdmin):
    ...

Visual View

Open the admin list view and see the map above the list of objects. Every object in the list is represented on the map.

Also, the bounding box filter is added to the list of filters.

Use a bounding box filter to filter objects by the geometry. Just press the 'Current map bounding box' link to filter out objects outside of the current map bounding box. The current filtering box will be represented on the map as a rectangle. The color of the rectangle is shown to the right of the 'Current map bounding box' link. Manual input of the bounding_box parameter in the address box also works.

As usual, pressing the filter or paging link will reload a page with new parameters. The map keeps its position for standard static Django filters and pager using permalink.

Customizing view

The geodata shown on the map is represented as GeoJSON feature collection. Every GeoJSON feature corresponds to one geo field of one Django model instance. All standard Django geometry-based fields are shown on the map by default. Every such feature has the following list of mandatory properties to be used:

  • field identifies the geometry field shown
  • app_label and model_name identify the model of the instance shown
  • pk is an instance primary key which identifies the model instance shown

The following optional GeoJSON feature properties are used to customize the look and feel of the feature on the map:

  • popup if present, is used to create a popup. A value started with '<' is used to create an HTML popup, else the text popup is used, see also bindPopup method
  • tooltip if present, is used to create a tooltip. A value started with '<' is used to create an HTML tooltip, else the text tooltip is used, see also bindTooltip method
  • line_style if present, is used to apply as an options parameter when creating lines and polygons, see also Leaflet Path options
  • point_style if present, is used as an options parameter to create a Leaflet marker, see also Marker options
  • an icon member of the point_style if present, is used as an options parameter to create a Leaflet icon, see also Icon options

The Admin class may override every part of this data, or even the whole data output overriding admin methods producing this data:

  • get_geojson_feature_list(request, queryset) returns the whole GeoJSON FeatureList instance representing a queryset
  • get_geojson_features(request, o, queryset) returns the features member of the FeatureList instance for the model instance o
  • get_geojson_geometry_fields(request, o, queryset) returns a list of geometry field names that need to be included in the feature list
  • get_geojson_feature(request, name, o, queryset) returns a GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_geometry(request, name, o, queryset) returns a geometry member of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_properties(request, name, o, queryset) returns a properties member of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_feature_popup(request, name, o, queryset) returns a popup property of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_feature_tooltip(request, name, o, queryset) returns a tooltip property of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_feature_verbose_name(request, name, o, queryset) returns a verbose name of the instance o geometry field name which is used to create popup and tooltip
  • get_geojson_feature_line_style(request, name, o, queryset) returns a line_style property of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_feature_point_style(request, name, o, queryset) returns a point_style property of the GeoJSON Feature instance representing the instance o geometry field name
  • get_geojson_feature_icon_style(request, name, o, queryset) returns an icon member of the point_style property of the GeoJSON Feature instance representing the instance o geometry field name
Owner
Vsevolod Novikov
Vsevolod Novikov
Django app for building dashboards using raw SQL queries

django-sql-dashboard Django app for building dashboards using raw SQL queries Brings a useful subset of Datasette to Django. Currently only works with

Simon Willison 383 Jan 06, 2023
A reusable Django model field for storing ad-hoc JSON data

jsonfield jsonfield is a reusable model field that allows you to store validated JSON, automatically handling serialization to and from the database.

Ryan P Kilby 1.1k Jan 03, 2023
django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Dave Hall 2.8k Jan 02, 2023
Backend with Django .

BackendCode - Cookies Documentation: https://docs.djangoproject.com/fr/3.2/intro/ By @tcotidiane33 & @yaya Models Premium class Pack(models.Model): n

just to do it 1 Jan 28, 2022
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

2.2k Jan 02, 2023
Django models and endpoints for working with large images -- tile serving

Django Large Image Models and endpoints for working with large images in Django -- specifically geared towards geospatial tile serving. DISCLAIMER: th

Resonant GeoData 42 Dec 17, 2022
Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot. A fully Django starter project.

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot πŸš€ Features A Django stater project with fully basic requirements for a production-ready

8 Jun 27, 2022
Store model history and view/revert changes from admin site.

django-simple-history django-simple-history stores Django model state on every create/update/delete. This app supports the following combinations of D

Jazzband 1.8k Jan 08, 2023
βœ‹ Auto logout a user after specific time in Django

django-auto-logout Auto logout a user after specific time in Django. Works with Python 🐍 β‰₯ 3.7, Django 🌐 β‰₯ 3.0. βœ”οΈ Installation pip install django-a

Georgy Bazhukov 21 Dec 26, 2022
πŸ”₯ Campus-Run Django ServerπŸ”₯

🏫 Campus-Run Campus-Run is a 3D racing game set on a college campus. Designed this service to comfort university students who are unable to visit the

Youngkwon Kim 1 Feb 08, 2022
A music recommendation REST API which makes a machine learning algorithm work with the Django REST Framework

music-recommender-rest-api A music recommendation REST API which makes a machine learning algorithm work with the Django REST Framework How it works T

The Reaper 1 Sep 28, 2021
Django API without Django REST framework.

Django API without DRF This is a API project made with Django, and without Django REST framework. This project was done with: Python 3.9.8 Django 3.2.

Regis Santos 3 Jan 19, 2022
PEP-484 type hints bindings for the Django web framework

mypy-django Type stubs to use the mypy static type-checker with your Django projects This project includes the PEP-484 compatible "type stubs" for Dja

Machinalis 223 Jun 17, 2022
A tool to automatically fix Django deprecations.

A tool to help upgrade Django projects to newer version of the framework by automatically fixing deprecations. The problem When maintaining a Django s

Bruno Alla 155 Dec 14, 2022
Use heroicons in your Django and Jinja templates.

heroicons Use heroicons in your Django and Jinja templates. Requirements Python 3.6 to 3.9 supported. Django 2.2 to 3.2 supported. Are your tests slow

Adam Johnson 52 Dec 14, 2022
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 06, 2023
Custom Django field for using enumerations of named constants

django-enumfield Provides an enumeration Django model field (using IntegerField) with reusable enums and transition validation. Installation Currently

5 Monkeys 195 Dec 20, 2022
a little task queue for python

a lightweight alternative. huey is: a task queue (2019-04-01: version 2.0 released) written in python (2.7+, 3.4+) clean and simple API redis, sqlite,

Charles Leifer 4.3k Dec 29, 2022
PostgreSQL with Docker + Portainer + pgAdmin + Django local

django-postgresql-docker Running PostgreSQL with Docker + Portainer + pgAdmin + Django local for development. This project was done with: Python 3.9.8

Regis Santos 4 Jun 12, 2022
Django Email Sender

Email-Sender Django Email Sender Installation 1.clone Repository & Install Packages git clone https://github.com/telman03/Email-Sender.git pip install

Telman Gadimov 0 Dec 26, 2021