-
Notifications
You must be signed in to change notification settings - Fork 215
/
admin.py
28 lines (20 loc) · 960 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Link, SideBar
from typeidea.custom_site import custom_site
from typeidea.base_admin import BaseOwnerAdmin
@admin.register(Link, site=custom_site)
class LinkAdmin(BaseOwnerAdmin):
list_display = ('title', 'href', 'status', 'weight', 'created_time')
fields = ('title', 'href', 'status', 'weight')
def save_model(self, request, obj, form, change):
obj.owner = request.user
return super(LinkAdmin, self).save_model(request, obj, form, change)
@admin.register(SideBar, site=custom_site)
class SideBarAdmin(BaseOwnerAdmin):
list_display = ('title', 'display_type', 'content', 'created_time')
fields = ('title', 'display_type', 'content')
def save_model(self, request, obj, form, change):
obj.owner = request.user
return super(SideBarAdmin, self).save_model(request, obj, form, change)