我想在管理面板中为“添加”操作添加自定义视图。我写了下面的代码并得到了一个错误
"NoReverseMatch Reverse for 'app_list' with arguments '()'
and keyword arguments '{'app_label': ''}' not found."
class UserDictionaryAdmin(BaseAdmin):
list_display = ('word', 'user', 'word_state')
class Meta:
app_label = 'default'
def add_view(self, request, form_url=None, extra_content=None):
return render_to_response('admin/userdictionary_add.html', self.model._meta)
urls.py
未被修改。
此外,我尝试了相同的结构而没有'self.model._meta'
,没有任何正面结果。