这是我的admin.py文件。除了BikeAdmin之外,如何将admin.OSMGeoAdmin添加到admin.site.register?
from django.contrib.gis import admin
from models import Bike, RideInfo
class BikeInline(admin.TabularInline):
model = RideInfo
extra = 1
class BikeAdmin(admin.ModelAdmin):
inlines = [BikeInline]
admin.site.register(Bike,BikeAdmin) #want to register admin.OSMGeoAdmin also
答案 0 :(得分:1)
试试这个:
from django.contrib.gis.admin import OSMGeoAdmin
from django.contrib.gis import admin
from models import Bike, RideInfo
class BikeInline(admin.TabularInline):
model = RideInfo
extra = 1
class BikeAdmin(OSMGeoAdmin):
inlines = [BikeInline]
admin.site.register(Bike,BikeAdmin)