# add admin
This commit is contained in:
parent
10fbfb97fe
commit
665d5d21eb
|
@ -1,3 +1,19 @@
|
|||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from .models import User
|
||||
|
||||
# Register your models here.
|
||||
|
||||
USER_FIELDS = (
|
||||
(None, {'fields': ('username', 'email', 'password1', 'password2',)}),
|
||||
)
|
||||
|
||||
|
||||
class CustomUserAdmin(UserAdmin):
|
||||
list_display = ('username', 'email', 'position', 'is_staff')
|
||||
add_fieldsets = USER_FIELDS
|
||||
fieldsets = UserAdmin.fieldsets + (
|
||||
(None, {'fields': ('phone', 'position', 'department', 'introduction')}),
|
||||
)
|
||||
|
||||
|
||||
admin.site.register(User, CustomUserAdmin)
|
|
@ -1,3 +1,18 @@
|
|||
from django.contrib import admin
|
||||
from .models import Mosquito, MosqPost
|
||||
|
||||
# Register your models here.
|
||||
|
||||
class MosquitoAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'device_id', 'region')
|
||||
list_filter = ('name', 'device_id', 'region')
|
||||
ordering = ('name', 'region')
|
||||
|
||||
|
||||
class MosqPostAdmin(admin.ModelAdmin):
|
||||
list_display = ('mosq', 'led', 'energy', 'time')
|
||||
list_filter = ('mosq', 'time')
|
||||
ordering = ['time']
|
||||
|
||||
|
||||
admin.site.register(Mosquito, MosquitoAdmin)
|
||||
admin.site.register(MosqPost, MosqPostAdmin)
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
from django.contrib import admin
|
||||
from .models import SmartModule, SmartPush
|
||||
|
||||
# Register your models here.
|
||||
|
||||
class SmartModuleAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'desc', 'device_id', 'chip_id')
|
||||
list_filter = ('name', 'device_id', 'chip_id')
|
||||
ordering = ('name', 'device_id')
|
||||
|
||||
|
||||
class SmartPushAdmin(admin.ModelAdmin):
|
||||
list_display = ('smart', 'signal', 'coordinate', 'time')
|
||||
list_filter = ('smart', 'time')
|
||||
ordering = ['time']
|
||||
|
||||
|
||||
admin.site.register(SmartModule, SmartModuleAdmin)
|
||||
admin.site.register(SmartPush, SmartPushAdmin)
|
||||
|
|
Loading…
Reference in New Issue