desertvegetationcommunitysu.../dashboard/admin.py

46 lines
1.5 KiB
Python

from django.contrib import admin
# Register your models here.
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from dashboard.models import UserProfile, Jurisdiction, Findings, Sampletrees, Verificationcode, Task, Special, Landuse, \
Landusetype
"""用户模块扩展"""
class ProfileInline(admin.StackedInline):
model = UserProfile
#fk_name = 'user'
max_num = 1
can_delete = False
class CustomUserAdmin(UserAdmin):
inlines = [ProfileInline,]
admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)
"""用户模块扩展"""
class JurisdictionAdmin(admin.ModelAdmin):
list_display = ('id','jurisdiction','explain')
admin.site.register(Jurisdiction,JurisdictionAdmin)
class UserProfileAdmin(admin.ModelAdmin):
list_display = ('jurisdiction',)
admin.site.register(UserProfile,UserProfileAdmin)
class FindingsAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Findings,FindingsAdmin)
class SampletreesAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Sampletrees,SampletreesAdmin)
class VerificationcodeAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Verificationcode,VerificationcodeAdmin)
class TaskAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Task,TaskAdmin)
class SpecialAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Special,SpecialAdmin)
class LandusetypeAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Landusetype,LandusetypeAdmin)