문제

So I simply want to use the delete() from the django.contrib.comments.views.moderation module, but only allowing the users with permission to delete their comments. In order to do this, all I have to do is uncomment #@permission_required("comments.delete_comment"), but I want to be able to do this without modifying the django framework. How can I modify/extend this view to my project? I guess the better question would be, what is the best way to change the setting for the delete() without changing anything in the django framework?

도움이 되었습니까?

해결책

That line is only commented out because Django 1.1 maintains compatibility with Python 2.3 which doesn't support the decorator (@) syntax. But the view is decorated with permission_required nonetheless (with syntax that is compatible with Python 2.3), as you can see here. Django 1.2 will drop support for Python 2.3 and will switch to the @-syntax. This is already visible on trunk.

Bottom line: you have to do nothing, as Django does already exactly what you want (this seems to be a recurring theme with Django :-) ).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top