#coding=utf-8
from models import Recruitment
from django.contrib import admin
class RecruitmentAdmin(admin.ModelAdmin):
list_display = ('name', 'category', 'content', 'user', 'create_time')
list_filter = ['create_time','category']
fields = ('name', 'category', 'content')
search_fields = ('name', 'content')
class Media:
css = {'all':('/editor/skins/default.css',)}
js = ('/editor/kindeditor-min.js','/editor/content.js')
def save_model(self, request, obj, form, change):
obj.user = request.user
obj.save()
admin.site.register(Recruitment,RecruitmentAdmin)
以上代码是一个models和admin的映射 我重写了admin的save方法
你去文档找删除方法重写就可以 或者重写models的 delete方法也能达到目的
def delete(self):
'''
删除
'''
#TODO something
super(self.__class__,self).delete()
实在不行你就加我Q吧 我空间里面有