{"id":23151449,"url":"https://github.com/felixthec/django-json-convertible-models","last_synced_at":"2025-04-04T15:15:27.356Z","repository":{"id":57420545,"uuid":"241357879","full_name":"FelixTheC/django-json-convertible-models","owner":"FelixTheC","description":"JSON Convertible Model is a Django app to replace models.Model and make it possible that models will be able to return JSON-Objects directly","archived":false,"fork":false,"pushed_at":"2021-02-24T19:15:49.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T09:51:26.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FelixTheC.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-18T12:40:07.000Z","updated_at":"2024-05-19T17:32:38.000Z","dependencies_parsed_at":"2022-09-16T09:21:18.790Z","dependency_job_id":null,"html_url":"https://github.com/FelixTheC/django-json-convertible-models","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixTheC%2Fdjango-json-convertible-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixTheC%2Fdjango-json-convertible-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixTheC%2Fdjango-json-convertible-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixTheC%2Fdjango-json-convertible-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FelixTheC","download_url":"https://codeload.github.com/FelixTheC/django-json-convertible-models/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198466,"owners_count":20900081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T18:33:18.790Z","updated_at":"2025-04-04T15:15:27.314Z","avatar_url":"https://github.com/FelixTheC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"======================\nJSON Convertible Model\n======================\n\nJSON Convertible Model is a Django app to replace models.Model and make it possible that models will\nbe able to return JSON-Objects directly without creating an new serializer class object.\nIt will not replace the awesome Django-Restframework package but sometimes it is to much afford for me.\nDetailed documentation is in the \"docs\" directory.\n\nQuick start\n-----------\n\n1. Add \"convertable_model\" to your INSTALLED_APPS setting like this::\n\n    INSTALLED_APPS = [\n        ...\n        'convertable_model',\n    ]\n\n2. Create your own models and choose \"JSONConvertibleModel\" as class to inherit from::\n\n    class FooModel(JSONConvertibleModel):\n        ...\n\n2.1. Define which fields you want to use::\n\n    class FooModel(JSONConvertibleModel):\n        ...\n\n        json_fields = '__all__'\n\n    or\n\n    class FooModel(JSONConvertibleModel):\n        ...\n\n        json_fields = ('field1', 'field2', )\n\n2.2. Define the JSON-Key's if you want to give them a different name::\n\n    class FooModel(JSONConvertibleModel):\n        ...\n\n        @jsonify_me\n        def json_aliases(self):\n            return {\n                'foo1': 'IntegerField',\n                'foo2': 'My_name'\n            }\n\n2.3 If you want to change the return value of the field::\n\n    class FooModel(JSONConvertibleModel):\n        ...\n\n        @jsonify_me\n        def prefix_foobar2(self):\n        # import is the decorator and that the field name is written in \"{foo}_{attribute}\"\n            return self.foobar2.upper()","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixthec%2Fdjango-json-convertible-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixthec%2Fdjango-json-convertible-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixthec%2Fdjango-json-convertible-models/lists"}