인 사용자 정의 Django 관리 사이트 내 URL 패턴은 다음과 같습니다 : (r '^ fb/custom/(? P [a-zA-Z0-9 +] *)/admin /', include (custom_admin_site 나는 인덱스처럼보기 방법에서 있었던 파라미터의 custom_ID를 필요하지 않습니다부모 URL 매개 변수가
def admin_view(self, view, cacheable=False):
def inner(request, *args, **kwargs):
if kwargs.has_key('custom_id'):
request.custom_id = kwargs.pop('custom_id')
return view(request, *args, **kwargs)
if not cacheable:
inner = never_cache(inner)
# We add csrf_protect here so this function can be used as a utility
# function for any view, without having to repeat 'csrf_protect'.
if not getattr(view, 'csrf_exempt', False):
inner = csrf_protect(inner)
return update_wrapper(inner, view)
이 방법 : .urls)),
나는 내 관리자 사이트의 admin_view 메도을 무효화한다. 내 문제는 내가 urlresolvers.reverse ('custom-admin : index')를 사용할 수 없다는 것입니다.Page not found. Request URL: http://localhost:8000/fb/custom/(?P%3Ccustom_id%3E[a-zA-Z0-9%5C+]*)/admin/
확인없이 깜짝 : 나는 매개 변수없이 사용하는 경우 난이 오류가 발생합니다. custom_id 매개 변수를 제공하지 않았습니다. 그러나 매개 변수가 있으면이 오류가 발생합니다.
reverse() got an unexpected keyword argument 'custom_id'
이 문제를 해결하는 방법에 대해 알고 싶습니다. 역방향 조회를 사용하고 싶습니다. URL 템플릿 태그에도 동일한 문제가 있습니다. 당신의 URL 패턴과