{"action":"created","issue":{"url":"https://api.github.com/repos/dionyziz/rupture/issues/203","repository_url":"https://api.github.com/repos/dionyziz/rupture","labels_url":"https://api.github.com/repos/dionyziz/rupture/issues/203/labels{/name}","comments_url":"https://api.github.com/repos/dionyziz/rupture/issues/203/comments","events_url":"https://api.github.com/repos/dionyziz/rupture/issues/203/events","html_url":"https://github.com/dionyziz/rupture/pull/203","id":174581268,"number":203,"title":"Target & Victim models, views, urls","user":{"login":"esarafianou","id":17114347,"avatar_url":"https://avatars.githubusercontent.com/u/17114347?v=3","gravatar_id":"","url":"https://api.github.com/users/esarafianou","html_url":"https://github.com/esarafianou","followers_url":"https://api.github.com/users/esarafianou/followers","following_url":"https://api.github.com/users/esarafianou/following{/other_user}","gists_url":"https://api.github.com/users/esarafianou/gists{/gist_id}","starred_url":"https://api.github.com/users/esarafianou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esarafianou/subscriptions","organizations_url":"https://api.github.com/users/esarafianou/orgs","repos_url":"https://api.github.com/users/esarafianou/repos","events_url":"https://api.github.com/users/esarafianou/events{/privacy}","received_events_url":"https://api.github.com/users/esarafianou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-01T17:30:42Z","updated_at":"2016-12-21T16:54:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dionyziz/rupture/pulls/203","html_url":"https://github.com/dionyziz/rupture/pull/203","diff_url":"https://github.com/dionyziz/rupture/pull/203.diff","patch_url":"https://github.com/dionyziz/rupture/pull/203.patch"},"body":"New endpoints:\r\n/victim \r\n/target \r\n/victim/<victim_id>\r\n/victim/notstarted\r\n\r\nDue to changes to the database, `python manage.py migrate` after merging this PR\r\n\r\nI will update the architecture spec in a next PR"},"comment":{"url":"https://api.github.com/repos/dionyziz/rupture/issues/comments/268574422","html_url":"https://github.com/dionyziz/rupture/pull/203#issuecomment-268574422","issue_url":"https://api.github.com/repos/dionyziz/rupture/issues/203","id":268574422,"user":{"login":"Geekfish","id":511547,"avatar_url":"https://avatars.githubusercontent.com/u/511547?v=3","gravatar_id":"","url":"https://api.github.com/users/Geekfish","html_url":"https://github.com/Geekfish","followers_url":"https://api.github.com/users/Geekfish/followers","following_url":"https://api.github.com/users/Geekfish/following{/other_user}","gists_url":"https://api.github.com/users/Geekfish/gists{/gist_id}","starred_url":"https://api.github.com/users/Geekfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Geekfish/subscriptions","organizations_url":"https://api.github.com/users/Geekfish/orgs","repos_url":"https://api.github.com/users/Geekfish/repos","events_url":"https://api.github.com/users/Geekfish/events{/privacy}","received_events_url":"https://api.github.com/users/Geekfish/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T16:54:55Z","updated_at":"2016-12-21T16:54:55Z","body":"Having another look a this, you could consider using [DRF](http://www.django-rest-framework.org/) instead of django json utils/forms/views.\r\n\r\nIt provides mature tools for building APIs, has excellent JSON support, it's highly customisable but also you can get started easily and pick and mix just the components you need (ex you don't have to use its routing tools, you could just use its json serializers etc)\r\n\r\nBut the most important thing is it promotes some good practices and separation of concerns.\r\n\r\nFor example this:\r\n```python\r\n    def get(self, request):\r\n        return JsonResponse({\r\n            'targets': list(Target.objects.all().values())\r\n        })\r\n```\r\nis currently serializing the Target in an implicit way. That means that if the schema of Target changes (and you add `Target._some_internal_field`) then the output of the response changes too, possibly exposing data you didn't intend.\r\n\r\nIdeally, even without DRF, you would have something like:\r\n```\r\ndef serialize_target(target):\r\n     return {\r\n          'id': target.id,\r\n          'whatever': target.whatever,\r\n          # ...\r\n     }\r\n```"}}
{"actor":{"display_login":"Geekfish"}}