def get_urls(self):
from django.conf.urls.defaults import patterns, url
urls = super(EmailSendAdmin, self).get_urls()
def warp(view):
def wrapper(*args, **kwargs):
return self.admin_site.admin_view(view)(*args, **kwargs)
return update_wrapper(wrapper, view)
all_url = patterns('',
url(r'^examplefn/$', warp(self.examplefn), name='examplefn'),
)
from django.conf.urls.defaults import patterns, url
urls = super(EmailSendAdmin, self).get_urls()
def warp(view):
def wrapper(*args, **kwargs):
return self.admin_site.admin_view(view)(*args, **kwargs)
return update_wrapper(wrapper, view)
all_url = patterns('',
url(r'^examplefn/$', warp(self.examplefn), name='examplefn'),
)
return all_url + urls
def examplefn(self, request):
pass
return render_to_response("admin/%s/%s/upload.html"%(self.model._meta.app_label, self.model._meta.module_name) , locals(), context_instance=RequestContext(request))
用法跟URLconf一样