{"id":34073502,"url":"https://github.com/bdvade/drf-admin","last_synced_at":"2025-12-14T08:56:30.970Z","repository":{"id":38240857,"uuid":"484835138","full_name":"BdVade/DRF-admin","owner":"BdVade","description":"A package to generate CRUD endpoints for registered models with the Django-REST Framework.","archived":false,"fork":false,"pushed_at":"2023-12-24T23:49:48.000Z","size":50,"stargazers_count":18,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-10T15:04:12.944Z","etag":null,"topics":["django","django-rest-framework","drf-admin","rest-api"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/drf-admin/","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/BdVade.png","metadata":{"files":{"readme":"README.md","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":"2022-04-23T19:10:39.000Z","updated_at":"2025-03-19T03:04:29.000Z","dependencies_parsed_at":"2022-09-26T21:12:16.160Z","dependency_job_id":null,"html_url":"https://github.com/BdVade/DRF-admin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BdVade/DRF-admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BdVade%2FDRF-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BdVade%2FDRF-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BdVade%2FDRF-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BdVade%2FDRF-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BdVade","download_url":"https://codeload.github.com/BdVade/DRF-admin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BdVade%2FDRF-admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27723880,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","django-rest-framework","drf-admin","rest-api"],"created_at":"2025-12-14T08:56:27.655Z","updated_at":"2025-12-14T08:56:30.964Z","avatar_url":"https://github.com/BdVade.png","language":"Python","readme":"# DRF-Admin\nA package to generate CRUD endpoints for registered models with the Django-REST Framework. \n\n## Requirements\n- [Django](https://docs.djangoproject.com/en/4.0/)\n- [Django Rest Framework](https://www.django-rest-framework.org/)\n\n## Installation\nTo install run:\n\n`pip install drf-admin`\n\n## Usage\n- Import restadmin in the admin.py \n- Call `restadmin.site.register(Model)` Model being the model to register \n- Add rest admin to your urls.py file \n\n## Prerequisite\n- rest_framework should be properly set up to use this package hitch free\n\nA sample of it's configuration in the settings file:\n```python\n REST_FRAMEWORK={\n            'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',\n            'TEST_REQUEST_RENDERER_CLASSES': [\n                'rest_framework.renderers.MultiPartRenderer',\n                'rest_framework.renderers.JSONRenderer',\n                'rest_framework.renderers.TemplateHTMLRenderer', ],\n            \"DEFAULT_AUTHENTICATION_CLASSES\": [\n                'rest_framework.authentication.SessionAuthentication',\n                'rest_framework.authentication.BasicAuthentication'\n            ],\n            \"DEFAULT_PERMISSION_CLASSES\": [\n                'rest_framework.permissions.AllowAny',\n            ]\n        }\n```\n\nFor example: \n\nmodels.py\n```python\nfrom django.db import models\n\nclass TestModel(models.Model):\n    age = models.IntegerField()\n```\n\nadmin.py\n```python\nfrom .models import TestModel\nimport restadmin\n\nrestadmin.site.register(TestModel)\n```\nurls.py\n```python\nfrom restadmin import site\nfrom django.urls import path\n\n\n\n\nurlpatterns = [\n    ...\n    path('restadmin/', site.urls),\n    ...\n]\n```\n\n## Customization\nThis package allows you to specify the following when registering your model\n- `serializer_or_modeladmin`: A Model Serializer Class or a subclass of `RestModelAdmin`\n- ` permission_classes`: A list of Permission classes\n- `pagination_classs`: A Pagination Class\n\nAn example of how a call to the register method with all 3 would look is :\n```python\nrestadmin.site.register(TestModel, serializer_or_modeladmin=AdminSerializer, permission_classes=[ReadOnly], \n                        pagination_class=LargeResultsSetPagination)\n\n```\n\n`RestModelAdmin` expose the same interface as `ModelViewSet` so you can add the whole customizations that\n`ModelViewSet` offers. This includes:\n\n- Custom querysets\n- redifining defaults methods\n- add actions as ModelViewSet's exta actions\n\nYou can also register models with the `register` decorator\n\nExample:\n```python\nfrom restadmin import register, RestModelAdmin\nfrom .models import TestModel\n\n@register(TestModel)\nclass TestRestModelAdmin(RestModelAdmin):\n\n    serializer_class = MyCustomSerializer # Optional. A default is provided if None defined\n\n    def get_queryset(self):\n        queryset = TestModel.objects.filter(age__lt=30)\n        return queryset\n\n```\n\n## Endpoint Documentation\n* This requires you to have coreapi installed\n\nA page to document the Endpoints generated can be accessed by adding the following to your base urls file\n\n```python\nfrom restadmin import site\n\n\nurlpatterns = [\n   ...\n    path('restadmin-docs/', site.docs)\n    ...\n]\n```\n\n\nUsing this would require you to have your default schema Class set in your REST_FRAMEWORK config in your settings.py file\nE.g\n\n```\nREST_FRAMEWORK = { 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' }\n```\nRun your server and you can find the documentation at ` http://127.0.0.1:8000/restadmin-docs`\nNOTE: The Documentation page is restricted to staff only(is_staff has to be True)\n## Tests\nTo run the tests:\n\nFrom the base directory run :\n```\npython load_tests.py\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdvade%2Fdrf-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdvade%2Fdrf-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdvade%2Fdrf-admin/lists"}