{"action":"created","issue":{"url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/19","repository_url":"https://api.github.com/repos/aljp/drf_model_pusher","labels_url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/19/comments","events_url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/19/events","html_url":"https://github.com/aljp/drf_model_pusher/issues/19","id":345577878,"node_id":"MDU6SXNzdWUzNDU1Nzc4Nzg=","number":19,"title":"PusherBackend isn't subclassable","user":{"login":"mattjegan","id":2116020,"node_id":"MDQ6VXNlcjIxMTYwMjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2116020?v=4","gravatar_id":"","url":"https://api.github.com/users/mattjegan","html_url":"https://github.com/mattjegan","followers_url":"https://api.github.com/users/mattjegan/followers","following_url":"https://api.github.com/users/mattjegan/following{/other_user}","gists_url":"https://api.github.com/users/mattjegan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjegan/subscriptions","organizations_url":"https://api.github.com/users/mattjegan/orgs","repos_url":"https://api.github.com/users/mattjegan/repos","events_url":"https://api.github.com/users/mattjegan/events{/privacy}","received_events_url":"https://api.github.com/users/mattjegan/received_events","type":"User","site_admin":false},"labels":[{"id":1001611054,"node_id":"MDU6TGFiZWwxMDAxNjExMDU0","url":"https://api.github.com/repos/aljp/drf_model_pusher/labels/bug","name":"bug","color":"d73a4a","default":true}],"state":"open","locked":false,"assignee":{"login":"mattjegan","id":2116020,"node_id":"MDQ6VXNlcjIxMTYwMjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2116020?v=4","gravatar_id":"","url":"https://api.github.com/users/mattjegan","html_url":"https://github.com/mattjegan","followers_url":"https://api.github.com/users/mattjegan/followers","following_url":"https://api.github.com/users/mattjegan/following{/other_user}","gists_url":"https://api.github.com/users/mattjegan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjegan/subscriptions","organizations_url":"https://api.github.com/users/mattjegan/orgs","repos_url":"https://api.github.com/users/mattjegan/repos","events_url":"https://api.github.com/users/mattjegan/events{/privacy}","received_events_url":"https://api.github.com/users/mattjegan/received_events","type":"User","site_admin":false},"assignees":[{"login":"mattjegan","id":2116020,"node_id":"MDQ6VXNlcjIxMTYwMjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2116020?v=4","gravatar_id":"","url":"https://api.github.com/users/mattjegan","html_url":"https://github.com/mattjegan","followers_url":"https://api.github.com/users/mattjegan/followers","following_url":"https://api.github.com/users/mattjegan/following{/other_user}","gists_url":"https://api.github.com/users/mattjegan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjegan/subscriptions","organizations_url":"https://api.github.com/users/mattjegan/orgs","repos_url":"https://api.github.com/users/mattjegan/repos","events_url":"https://api.github.com/users/mattjegan/events{/privacy}","received_events_url":"https://api.github.com/users/mattjegan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-07-30T00:44:57Z","updated_at":"2018-07-30T11:08:29Z","closed_at":null,"author_association":"COLLABORATOR","body":"I needed to add some custom logic to `PusherBackend.get_packet` to handle types that weren't json serializable. To do this across my whole project I created a subclass like so:\r\n\r\n```python\r\nclass MyPusherBackend(PusherBackend):\r\n    def get_packet(self, event, instance):\r\n         ...\r\n```\r\n\r\nThen had backends like so:\r\n\r\n```python\r\nclass MyModelBackend(MyPusherBackend):\r\n     serializer_class = MyModelSerializer\r\n```\r\n\r\nThis works when you declare `class MyModelBackend(PusherBackend)` however it doesn't work with the extra subclassing of `MyPusherBackend`. The error trace is as follows:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/utils/autoreload.py\", line 228, in wrapper\r\n    fn(*args, **kwargs)\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/core/management/commands/runserver.py\", line 116, in inner_run\r\n    autoreload.raise_last_exception()\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/utils/autoreload.py\", line 251, in raise_last_exception\r\n    six.reraise(*_exception)\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/utils/six.py\", line 685, in reraise\r\n    raise value.with_traceback(tb)\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/utils/autoreload.py\", line 228, in wrapper\r\n    fn(*args, **kwargs)\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/__init__.py\", line 27, in setup\r\n    apps.populate(settings.INSTALLED_APPS)\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/django/apps/registry.py\", line 116, in populate\r\n    app_config.ready()\r\n  File \"/Users/eganm/Documents/myproj/Code/myproj/core/apps.py\", line 16, in ready\r\n    from core.pusher_backends import MyModelBackend\r\n  File \"/Users/eganm/Documents/myproj/Code/myproj/core/pusher_backends.py\", line 10, in <module>\r\n    class MyPusherBackend(PusherBackend):\r\n  File \"/Users/eganm/.local/share/virtualenvs/myproj-xqRGoeqW/lib/python3.6/site-packages/drf_model_pusher/backends.py\", line 30, in __new__\r\n    model_name = dicts['serializer_class'].Meta.model.__name__.lower()\r\nKeyError: 'serializer_class\r\n```\r\n\r\nWhen I get the chance I'm happy to submit a PR for this."},"comment":{"url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/comments/408827890","html_url":"https://github.com/aljp/drf_model_pusher/issues/19#issuecomment-408827890","issue_url":"https://api.github.com/repos/aljp/drf_model_pusher/issues/19","id":408827890,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODgyNzg5MA==","user":{"login":"aljp","id":1378224,"node_id":"MDQ6VXNlcjEzNzgyMjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1378224?v=4","gravatar_id":"","url":"https://api.github.com/users/aljp","html_url":"https://github.com/aljp","followers_url":"https://api.github.com/users/aljp/followers","following_url":"https://api.github.com/users/aljp/following{/other_user}","gists_url":"https://api.github.com/users/aljp/gists{/gist_id}","starred_url":"https://api.github.com/users/aljp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aljp/subscriptions","organizations_url":"https://api.github.com/users/aljp/orgs","repos_url":"https://api.github.com/users/aljp/repos","events_url":"https://api.github.com/users/aljp/events{/privacy}","received_events_url":"https://api.github.com/users/aljp/received_events","type":"User","site_admin":false},"created_at":"2018-07-30T11:08:29Z","updated_at":"2018-07-30T11:08:29Z","author_association":"OWNER","body":"There's something for this!\r\n\r\n```\r\nclass Meta:\r\n    abstract = True\r\n```\r\n\r\nThis needs to be documented though"}}
{"actor":{"display_login":"aljp"}}