注册多个管理员到django

时间:2014-10-30 22:00:37

标签: django geodjango

这是我的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

1 个答案:

答案 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)