{"action":"created","issue":{"url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/40","labels_url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/40/comments","events_url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/40/events","html_url":"https://github.com/borgstrom/django-simple-menu/issues/40","id":124618814,"number":40,"title":"Allow MenuItem to be subclassed","user":{"login":"georgema1982","id":727970,"avatar_url":"https://avatars.githubusercontent.com/u/727970?v=3","gravatar_id":"","url":"https://api.github.com/users/georgema1982","html_url":"https://github.com/georgema1982","followers_url":"https://api.github.com/users/georgema1982/followers","following_url":"https://api.github.com/users/georgema1982/following{/other_user}","gists_url":"https://api.github.com/users/georgema1982/gists{/gist_id}","starred_url":"https://api.github.com/users/georgema1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgema1982/subscriptions","organizations_url":"https://api.github.com/users/georgema1982/orgs","repos_url":"https://api.github.com/users/georgema1982/repos","events_url":"https://api.github.com/users/georgema1982/events{/privacy}","received_events_url":"https://api.github.com/users/georgema1982/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-03T00:08:01Z","updated_at":"2016-01-03T00:47:56Z","closed_at":null,"body":"Right now it seems that there's no way to sublcass MenuItem as it will cause circular import. Any idea how to allow subclassing MenuItem?"},"comment":{"url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/comments/168447168","html_url":"https://github.com/borgstrom/django-simple-menu/issues/40#issuecomment-168447168","issue_url":"https://api.github.com/repos/borgstrom/django-simple-menu/issues/40","id":168447168,"user":{"login":"georgema1982","id":727970,"avatar_url":"https://avatars.githubusercontent.com/u/727970?v=3","gravatar_id":"","url":"https://api.github.com/users/georgema1982","html_url":"https://github.com/georgema1982","followers_url":"https://api.github.com/users/georgema1982/followers","following_url":"https://api.github.com/users/georgema1982/following{/other_user}","gists_url":"https://api.github.com/users/georgema1982/gists{/gist_id}","starred_url":"https://api.github.com/users/georgema1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgema1982/subscriptions","organizations_url":"https://api.github.com/users/georgema1982/orgs","repos_url":"https://api.github.com/users/georgema1982/repos","events_url":"https://api.github.com/users/georgema1982/events{/privacy}","received_events_url":"https://api.github.com/users/georgema1982/received_events","type":"User","site_admin":false},"created_at":"2016-01-03T00:47:56Z","updated_at":"2016-01-03T00:47:56Z","body":"Imagine an app that needs access control. Usually we add access control on the view either using django's decorator, third party mixins like django-braces or any other kind of validation function we define on the view. If the view doesn't allow the current user to access it, the corresponding menu item shouldn't be displayed. I know MenuItem allows a callable check parameter to be passed in. But it's basically an access control logic on the menu level that duplicates that of view's. To me, it's not DRY enough.\r\n\r\nThe way I'm trying to subclass it is that I want to override check_check function. The logic is that if check callable isn't provided, I can infer the view from the url of the menu item. Then I can get access control data or logic from the view and the check callable can have a default behavior.\r\n\r\nAnother option is that the check callable should accept another parameter, aka url, besides request."}}