desertvegetationcommunitysu.../dashboard/admin.py

46 lines
1.5 KiB
Python
Raw Normal View History

2020-07-12 12:40:52 +00:00
from django.contrib import admin
# Register your models here.
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
2020-09-18 01:17:42 +00:00
from dashboard.models import UserProfile, Jurisdiction, Findings, Sampletrees, Verificationcode, Task, Special, Landuse, \
Landusetype
2020-07-12 12:40:52 +00:00
"""用户模块扩展"""
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)
2020-09-18 01:17:42 +00:00
class LandusetypeAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Landusetype,LandusetypeAdmin)