{"id":18275112,"url":"https://github.com/the-arcade-01/drf-api","last_synced_at":"2025-04-09T03:44:59.853Z","repository":{"id":46838215,"uuid":"283305870","full_name":"the-arcade-01/DRF-API","owner":"the-arcade-01","description":"An API backend for an application with entity relation table.","archived":false,"fork":false,"pushed_at":"2021-09-22T19:32:09.000Z","size":104,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T22:29:23.599Z","etag":null,"topics":["django-rest-framework","nested-serializers","pagination","pagination-api","production-ready"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-arcade-01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-28T19:17:18.000Z","updated_at":"2023-07-19T04:28:06.000Z","dependencies_parsed_at":"2022-09-16T23:00:23.153Z","dependency_job_id":null,"html_url":"https://github.com/the-arcade-01/DRF-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-arcade-01%2FDRF-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-arcade-01%2FDRF-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-arcade-01%2FDRF-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-arcade-01%2FDRF-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-arcade-01","download_url":"https://codeload.github.com/the-arcade-01/DRF-API/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974594,"owners_count":21026742,"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":["django-rest-framework","nested-serializers","pagination","pagination-api","production-ready"],"created_at":"2024-11-05T12:11:53.204Z","updated_at":"2025-04-09T03:44:59.823Z","avatar_url":"https://github.com/the-arcade-01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DRF-API\n## Description\nAn API backend for an application with entity relation table.\n\n\u003cb\u003eCountry\u003c/b\u003e\u003cbr\u003e\nkey | Data type | Description\n------------ | ------------- | -------------\nid | Primary Key | \nName | Character Field | Name of the country\nDescription | Text Field | Description of country\nPopulation | Integer Field |\nGDP | Float Field |\n\n\u003cb\u003eState\u003c/b\u003e\u003cbr\u003e\nkey | Data type | Description\n------------ | ------------- | -------------\nid | Primary Key | \nCountry | Foreign Key | Relation to country\nName | Character Field | Name of the state\nDescription | Text Field | Description of state\nPopulation | Integer Field |\nGDP | Float Field |\n\n\u003cb\u003eCity\u003c/b\u003e\u003cbr\u003e\nkey | Data type | Description\n------------ | ------------- | -------------\nid | Primary Key | \nState | Foreign Key | Relation to State\nCountry | Foreign Key | Relation to Country\nName | Character Field | Name of the city\nDescription | Text Field | Description of city\nPopulation | Integer Field |\nGDP | Float Field |\nPin Code | Character Field |\n\n\u003cb\u003eTown\u003c/b\u003e\u003cbr\u003e\nkey | Data type | Description\n------------ | ------------- | -------------\nid | Primary Key | \nState | Foreign Key | Relation to State\nCountry | Foreign Key | Relation to Country\nName | Character Field | Name of the Town\nDescription | Text Field | Description of Town\nPopulation | Integer Field |\nGDP | Float Field |\nPin Code | Character Field |\n\n\u003cb\u003ePerson\u003c/b\u003e\u003cbr\u003e\nkey | Data type | Description\n------------ | ------------- | -------------\nid | Primary Key | \nName | Character Field | Name of the Person\nState | Foreign Key | Relation to State\nCountry | Foreign Key | Relation to Country\nCity | Foreign Key | Relation to city\nTown | Foreign Key | Relation to town\n## Setup\n1. Initial Setup\n- Clone this repository : `https://github.com/the-arcade-01/DRF-API.git`\n- Install Requirements : `pip install -r requirements.txt`\n2. Backend Setup\n- cd to Backend and run following sets of commands\n  - `python manage.py makemigrations`\n  - `python manage.py migrate`\n- Create super user by `python manage.py createsuperuser`\u003cbr\u003e\n\u003cb\u003eNOTE: API required Basic Authentication, creating superuser is must\u003c/b\u003e\u003cbr\u003e\n## API Overview\nAPI url set\n```\nadmin/\ncountry-viewset/\ncountry-viewset/\u003cint:id\u003e/\nstate-viewset/\nstate-viewset/\u003cint:id\u003e/\ncity-viewset/\ncity-viewset/\u003cint:id\u003e/\ntown-viewset/\ntown-viewset/\u003cint:id\u003e/\nperson-viewset/\nperson-viewset/\u003cint:id\u003e/\n\n```\n1. Country Viewset\nURLs:\n- For entire data with Pagination `http://127.0.0.1:8000/country-viewset/`\n- For individual data `http://127.0.0.1:8000/country-viewset/\u003cint:id\u003e/`\u003cbr\u003e\n\nResponse examples:\n```javascript\nHTTP 200 OK\nAllow: GET, POST, HEAD, OPTIONS\nContent-Type: application/json\nVary: Accept\n\n{\n    \"count\": 3,\n    \"next\": \"http://127.0.0.1:8000/country-viewset/api/?page=2\",\n    \"previous\": null,\n    \"results\": [\n        {\n            \"id\": 8,\n            \"name\": \"India\",\n            \"description\": \"India is a diverse country\",\n            \"population\": 1300,\n            \"gdp\": 3.202,\n            \"state_country\": [\n                {\n                    \"id\": 12,\n                    \"country\": 8,\n                    \"name\": \"Madhya Pradesh\",\n                    \"description\": \"Central state of India\",\n                    \"population\": 45,\n                    \"gdp\": 0.002,\n                    \"city_state\": [\n                        {\n                            \"id\": 6,\n                            \"country\": 8,\n                            \"state\": 12,\n                            \"name\": \"Bhopal\",\n                            \"description\": \"City of Lakes\",\n                            \"population\": 20,\n                            \"gdp\": 0.00134,\n                            \"pin_code\": \"400001\",\n                            \"person_city\": [\n                                {\n                                    \"id\": 6,\n                                    \"name\": \"Anish\",\n                                    \"country\": 8,\n                                    \"state\": 12,\n                                    \"city\": 6,\n                                    \"town\": 4\n                                }\n                            ]\n                        }\n                    ],\n                    \"town_state\": [\n                        {\n                            \"id\": 4,\n                            \"country\": 8,\n                            \"state\": 12,\n                            \"name\": \"GandhiNagar\",\n                            \"description\": \"Town in MP\",\n                            \"population\": 5,\n                            \"gdp\": 0.00015,\n                            \"pin_code\": \"400101\",\n                            \"person_town\": [\n                                {\n                                    \"id\": 6,\n                                    \"name\": \"Anish\",\n                                    \"country\": 8,\n                                    \"state\": 12,\n                                    \"city\": 6,\n                                    \"town\": 4\n                                }\n                            ]\n                        }\n                    ]\n                },\n                {\n                    \"id\": 11,\n                    \"country\": 8,\n                    \"name\": \"Maharashtra\",\n                    \"description\": \"Jai Maharashtra!!\",\n                    \"population\": 123,\n                    \"gdp\": 0.0034,\n                    \"city_state\": [],\n                    \"town_state\": []\n                }\n            ]\n        }\n    ]\n}\n```\n2. Person Viewset\nURLs:\n- For entire data with Pagination `http://127.0.0.1:8000/person-viewset/`\n- For individual data `http://127.0.0.1:8000/person-viewset/\u003cint:id\u003e/`\u003cbr\u003e\n\nResponse examples:\n - Url : `/person-viewset/api/?page=2`\n```javascript\nHTTP 200 OK\nAllow: GET, POST, HEAD, OPTIONS\nContent-Type: application/json\nVary: Accept\n\n{\n    \"count\": 4,\n    \"next\": \"http://127.0.0.1:8000/person-viewset/api/?page=3\",\n    \"previous\": \"http://127.0.0.1:8000/person-viewset/api/\",\n    \"results\": [\n        {\n            \"id\": 6,\n            \"name\": \"Anish\",\n            \"country\": 8,\n            \"state\": 12,\n            \"city\": 6,\n            \"town\": 4\n        }\n    ]\n}\n```\n- Ordering and Search Filter Response : `/person-viewset/api/?ordering=name\u0026search=India`\n\nOrdering on Person Name and Search Filter on Country Name\n```javascript\nHTTP 200 OK\nAllow: GET, POST, HEAD, OPTIONS\nContent-Type: application/json\nVary: Accept\n\n{\n    \"count\": 2,\n    \"next\": \"http://127.0.0.1:8000/person-viewset/api/?ordering=name\u0026page=2\u0026search=India\",\n    \"previous\": null,\n    \"results\": [\n        {\n            \"id\": 6,\n            \"name\": \"Anish\",\n            \"country\": 8,\n            \"state\": 12,\n            \"city\": 6,\n            \"town\": 4\n        }\n    ]\n}\n```\n## Postman Collection\nPostman Collections can be found [Here](https://github.com/the-arcade-01/DRF-API/tree/master/Postman%20Collections)\n## Tasks\n- [X] API for Country, City, Town, State and Person\n- [X] CRUD for all\n- [X] ModelSerializer with Nested serializer\n- [X] Person relation with City and Town\n- [X] Pagination API for all\n- [X] Filter, Ordering and Searching for Person based on related keys\n- [X] selected_related() for speeding queries\n- [X] Postman Collections for all API\n- [X] Implemented views using ModelViewSet\n- [X] Comments and modular code\n\n### Created By [AASHISH RAMESH KOSHTI](https://github.com/the-arcade-01)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-arcade-01%2Fdrf-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-arcade-01%2Fdrf-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-arcade-01%2Fdrf-api/lists"}