diff options
author | luxagraf <sng@luxagraf.net> | 2024-05-01 11:44:22 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2024-05-01 11:44:22 -0500 |
commit | 436ed48c5d5f37ed388424efc0ec7389ffee8b81 (patch) | |
tree | 61780870fde7b4c5b0a993840ab0bb29c0fec75f | |
parent | 33e50f81111a5ad7833aa7b5498126468d7f11e8 (diff) |
updated code to remove OSMGeoAdmin for django 5
-rw-r--r-- | app/locations/admin.py | 12 | ||||
-rw-r--r-- | app/media/admin.py | 7 | ||||
-rw-r--r-- | app/planner/admin.py | 7 | ||||
-rw-r--r-- | app/posts/admin.py | 7 | ||||
-rw-r--r-- | app/sightings/admin.py | 5 | ||||
-rw-r--r-- | app/utils/widgets.py | 3 | ||||
-rw-r--r-- | templates/base.html | 6 |
7 files changed, 20 insertions, 27 deletions
diff --git a/app/locations/admin.py b/app/locations/admin.py index b428e0d..03f0696 100644 --- a/app/locations/admin.py +++ b/app/locations/admin.py @@ -1,5 +1,4 @@ from django.contrib import admin -from django.contrib.gis.admin import OSMGeoAdmin from .models import Region, Country, Location, State, Route, LuxCheckIn, Campsite, GPXFile, GPXTrack, Track @@ -9,7 +8,7 @@ from utils.widgets import LGEntryForm @admin.register(Region) -class RegionAdmin(OSMGeoAdmin): +class RegionAdmin(admin.ModelAdmin): list_display = ('name', 'slug') prepopulated_fields = {'slug': ('name',)} search_fields = ('name',) @@ -51,7 +50,7 @@ class RegionAdmin(OSMGeoAdmin): @admin.register(Country) -class CountryAdmin(OSMGeoAdmin): +class CountryAdmin(admin.ModelAdmin): list_display = ('name', 'pop2005', 'region', 'subregion') search_fields = ('name',) ordering = ('name',) @@ -117,7 +116,7 @@ class CountryAdmin(OSMGeoAdmin): @admin.register(State) -class StateAdmin(OSMGeoAdmin): +class StateAdmin(admin.ModelAdmin): list_display = ('name', 'code', 'slug', 'country', 'pub_date') prepopulated_fields = {'slug': ('name',)} search_fields = ('name', 'country') @@ -161,7 +160,7 @@ class StateAdmin(OSMGeoAdmin): @admin.register(Location) -class LocationAdmin(OSMGeoAdmin): +class LocationAdmin(admin.ModelAdmin): list_display = ('name', 'pub_date', 'parent', 'state', 'slug') prepopulated_fields = {'slug': ('name',)} search_fields = ('name', 'state') @@ -198,9 +197,8 @@ class LocationAdmin(OSMGeoAdmin): class Media: js = ('next-prev-links.js',) - @admin.register(Route) -class RouteAdmin(OSMGeoAdmin): +class RouteAdmin(admin.ModelAdmin): list_display = ('name', 'slug') prepopulated_fields = {'slug': ('name',)} search_fields = ('name',) diff --git a/app/media/admin.py b/app/media/admin.py index f28d259..8e05d8c 100644 --- a/app/media/admin.py +++ b/app/media/admin.py @@ -1,6 +1,5 @@ from django.contrib import admin from django import forms -from django.contrib.gis.admin import OSMGeoAdmin from .models import LuxImage, LuxGallery, LuxImageSize, LuxVideo from django.shortcuts import render from django.contrib.admin import helpers @@ -8,17 +7,17 @@ from django.http import HttpResponseRedirect @admin.register(LuxImageSize) -class LuxImageSizeAdmin(OSMGeoAdmin): +class LuxImageSizeAdmin(admin.ModelAdmin): list_display = ('name','slug', 'width', 'height', 'quality') @admin.register(LuxVideo) -class LuxVideoAdmin(OSMGeoAdmin): +class LuxVideoAdmin(admin.ModelAdmin): pass @admin.register(LuxImage) -class LuxImageAdmin(OSMGeoAdmin): +class LuxImageAdmin(admin.ModelAdmin): list_display = ('pk', 'admin_thumbnail', 'pub_date', 'caption', 'location') list_filter = ('pub_date', 'location') search_fields = ['title', 'caption', 'alt'] diff --git a/app/planner/admin.py b/app/planner/admin.py index 910558a..09048a6 100644 --- a/app/planner/admin.py +++ b/app/planner/admin.py @@ -1,6 +1,5 @@ from django.contrib import admin from django import forms -from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.contenttypes.admin import GenericStackedInline from utils.widgets import AdminImageWidget, LGEntryForm @@ -10,7 +9,7 @@ from media.models import LuxImage from utils.util import get_latlon @admin.register(CampIdea) -class PlannerAdmin(OSMGeoAdmin): +class PlannerAdmin(admin.ModelAdmin): list_display = ('name', ) #list_filter = ('has_water', ) # options for OSM map Using custom ESRI topo map @@ -34,7 +33,7 @@ class PlannerAdmin(OSMGeoAdmin): @admin.register(Camp) -class PlannerAdmin(OSMGeoAdmin): +class PlannerAdmin(admin.ModelAdmin): list_display = ('name', 'date_arrive', 'date_depart', 'distance_from_previous', 'price', 'site_number',) list_filter = ('date_arrive', 'has_water' ) # options for OSM map Using custom ESRI topo map @@ -58,5 +57,5 @@ class PlannerAdmin(OSMGeoAdmin): @admin.register(Trip) -class TripAdmin(OSMGeoAdmin): +class TripAdmin(admin.ModelAdmin): pass diff --git a/app/posts/admin.py b/app/posts/admin.py index d2d1a33..5c27f64 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -1,6 +1,5 @@ from django.contrib import admin from django import forms -from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.contenttypes.admin import GenericStackedInline from utils.widgets import AdminImageWidget, LGEntryForm @@ -11,7 +10,7 @@ from utils.util import get_latlon @admin.register(Post) -class PostAdmin(OSMGeoAdmin): +class PostAdmin(admin.ModelAdmin): form = LGEntryForm def get_queryset(self, request): @@ -96,7 +95,7 @@ class PostAdmin(OSMGeoAdmin): @admin.register(Trip) -class TripAdmin(OSMGeoAdmin): +class TripAdmin(admin.ModelAdmin): form = LGEntryForm list_display = ('title', 'order', 'date_started' ) prepopulated_fields = {'slug': ('title',)} @@ -127,7 +126,7 @@ class TripAdmin(OSMGeoAdmin): @admin.register(Guide) -class GuideAdmin(OSMGeoAdmin): +class GuideAdmin(admin.ModelAdmin): form = LGEntryForm list_display = ('title', 'is_featured', 'slug' ) prepopulated_fields = {'slug': ('title',)} diff --git a/app/sightings/admin.py b/app/sightings/admin.py index 610260e..7cc0319 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -1,6 +1,5 @@ import copy from django.contrib import admin -from django.contrib.gis.admin import OSMGeoAdmin from .models import APClass, AP, Sighting, FieldNote from utils.util import get_latlon @@ -13,7 +12,7 @@ class APClassAdmin(admin.ModelAdmin): list_filter = ('kind',) -class SightingInline(OSMGeoAdmin, admin.StackedInline): +class SightingInline(admin.ModelAdmin, admin.StackedInline): """ This is very fragile and probably a bad idea since I copied this code straight from Django and it may change, but unless GeoDjango @@ -98,7 +97,7 @@ class APAdmin(admin.ModelAdmin): @admin.register(Sighting) -class SightingAdmin(OSMGeoAdmin): +class SightingAdmin(admin.ModelAdmin): list_filter = (('location', admin.RelatedOnlyFieldListFilter), 'pub_date') list_display = ('ap', 'location', 'pub_date') search_fields = ['ap__common_name',] diff --git a/app/utils/widgets.py b/app/utils/widgets.py index 87b39ec..61f1722 100644 --- a/app/utils/widgets.py +++ b/app/utils/widgets.py @@ -2,7 +2,6 @@ import os from django import forms from django.contrib import admin from django.contrib.admin.widgets import AdminFileWidget -from django.contrib.gis.admin import OSMGeoAdmin from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from django.template.loader import render_to_string @@ -130,7 +129,7 @@ class LGEntryFormSmall(forms.ModelForm): } -class OLAdminBase(OSMGeoAdmin): +class OLAdminBase(admin.ModelAdmin): default_lon = -9285175 default_lat = 4025046 default_zoom = 15 diff --git a/templates/base.html b/templates/base.html index 1c9a90e..c0d815c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,7 +16,7 @@ title="Luxagraf RSS feed" href="https://luxagraf.net/rss/"> {%block stylesheet%}<link rel="stylesheet" - href="/media/screenv11.min.css?{% now "u" %}" + href="/media/screenv11.css?{% now "u" %}" media="screen">{%endblock%} {%block extrahead%}{%endblock%} </head> @@ -27,8 +27,8 @@ <span class="sitesubtitle" id="slogan">{%block sitesubtitle %}Walk Slowly{% endblock%}</span> </div> <nav> - <a class="nav-item smcaps" href="{% url "jrnl:list" %}" title="Stories of life on the road.">Friends</a> - <a class="nav-item smcaps" href="{% url "range:list" %}" title="Life and how to live it">Range</a> + <a class="nav-item smcaps" href="{% url "jrnl:list" %}" title="Stories of life on the road.">Jrnl</a> + <a class="nav-item smcaps" href="{% url "range:list" %}" title="Life and how to live it">Essays</a> <!--<a class="nav-item smcaps" href="{% url "guides:guide-list" %}" title="Guides">Guides</a> --> <a class="nav-item smcaps" href="/about" title="About Scott">About</a> <!-- |