The administration of the Location model is as simple as it can be. Perform the following steps:
- Let's create the administration settings for the Location model. Note that we are using the get_fieldsets() method to define the field sets, with a description rendered from a template, as follows:
# locations/admin.py from django.contrib import adminfrom django.template.loader import render_to_stringfrom django.utils.translation import ugettext_lazy as _from .models import Locationclass LocationAdmin(admin.ModelAdmin): save_on_top = True list_display = ("title", "street", "description") search_fields = ("title", "street", "description") def get_fieldsets(self, request, obj=None): map_html = render_to_string("admin/includes/map.html") ...