{"id":13468187,"url":"https://github.com/amirasaran/django-restful-admin","last_synced_at":"2025-07-13T07:34:17.737Z","repository":{"id":32066163,"uuid":"131161449","full_name":"amirasaran/django-restful-admin","owner":"amirasaran","description":"Django admin restful api","archived":false,"fork":false,"pushed_at":"2024-11-15T13:15:27.000Z","size":28,"stargazers_count":67,"open_issues_count":4,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-13T08:05:41.702Z","etag":null,"topics":["admin","django","django-admin","django-rest-framework","django-restful-admin","rest-api","restful"],"latest_commit_sha":null,"homepage":"","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/amirasaran.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-26T13:40:41.000Z","updated_at":"2025-05-03T16:25:11.000Z","dependencies_parsed_at":"2025-01-07T04:32:22.732Z","dependency_job_id":"277afcd8-fbed-44dd-934b-c82d6a22b90a","html_url":"https://github.com/amirasaran/django-restful-admin","commit_stats":{"total_commits":20,"total_committers":5,"mean_commits":4.0,"dds":0.65,"last_synced_commit":"e3d3c54ab74762442da4391642a3b8e50b68d608"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/amirasaran/django-restful-admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirasaran%2Fdjango-restful-admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirasaran%2Fdjango-restful-admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirasaran%2Fdjango-restful-admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirasaran%2Fdjango-restful-admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirasaran","download_url":"https://codeload.github.com/amirasaran/django-restful-admin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirasaran%2Fdjango-restful-admin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259606868,"owners_count":22883556,"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":["admin","django","django-admin","django-rest-framework","django-restful-admin","rest-api","restful"],"created_at":"2024-07-31T15:01:06.757Z","updated_at":"2025-06-13T08:05:59.829Z","avatar_url":"https://github.com/amirasaran.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n  \n# Expose Django's admin as a RESTFUL service  \n  \n \n - [x] Support all of restful api  \n - [x]  Auto generat serializers  \n - [x] Use [Django Rest Framework](http://www.django-rest-framework.org/)  \n - [x] Fully customization support  \n - [x] Using Django Rest Framework ViewSet as AdminModels\n - [x] Support default Django auth permission\n - [x] Support Django custom model permission with simple configuration\n - [x] Using Django Rest Framework Serializer(or ModelSerializer) as request validators\n - [x] Support Single Serializer class to customize your detail view\n - [x] Auto generate documentation for CURDs\n - [x] Pagination and ability to change paginator\n - [x] Support custom action with permission\n - [x] Support all features in DRF\n - [x] Support LogEntry (Log history of objects)\n\n## Todo\n - [ ] Add some documentation\n - [ ] Add custom route Api documentation\n - [ ] Add list_display\n - [ ] Add Filter And Search\n - [ ] Add exlude\n - [ ] Add Fields\n - [ ] Example inline\n - [ ] Localization\n - [ ] Somethings that's need in future \n\n  \n## How To Install  \n  \n pip install django-restful-admin  \nadd to `INSTALED_APPS`  \n  ```\n INSTALLED_APPS = [\n      ...  \n     'rest_framework',   \n    'django_restful_admin',    \n     ...  \n ]  \n ```\n## How To use  \nyou need only add the bellow code to  `admin.py` in your apps  \n  \n  ```\n from django_restful_admin import admin\n from yourapp.models improt FisrtModel, ScoundModel   \n\nadmin.site.register(FisrtModel)    \nadmin.site.register(ScoundModel)   \n```\n\nThen add URL to your project `urls.py`  \n  \n  ```\n from django_restful_admin import admin as api_admin \n    urlpatterns = [    \n        ...   \n        path('apiadmin/', api_admin.site.urls),  \n\t\t ...     \n  ]  \n```\n\nRun the project and open URL `http://your-ip:port/apiadmin/`  \n  \nenjoy!  \n  \n## Change Log  \n   - [x] export admin in __init__.py\n   - [x] Add default django auth permissions support\n   - [x] Add admin.register decorator\n  \n# Customization \n\n### Example\nCreate a new Django project\n```\n$ django-admin startproject example`\n$ cd example\n$ python manage.py startapp blog\n```\n\nCreate blog app models in `blog/models.py`\n```\nfrom django.db import models\n\nclass Category(models.Model)\n\ttitle = models.CharField(  \n\t  max_length=255  \n\t)\n\t\nclass Post(models.Model):\n\ttitle = models.CharField(  \n\t  max_length=255  \n\t)\n\tsummery = models.TextField()\n\tdescription = models.TextField()\n\tcategory = models.ForeignKey(  \n\t\tCategory,  \n\t\trelated_name='products',  \n\t\ton_delete=models.CASCADE  \n\t)\n```\n\nAdd your blog app in `INSTALLED_APPS` in `example/settings.py`\n\n```\nINSTALLED_APPS = [\n\t\t# Django default apps...\n\t\t'rest_framework',\n\t\t'django_restful_admin',\n\t\t\n\t\t'blog'\n]\n```\n\nAdd admin URLs to django URLs in `example/urls.py`\n\n```\nfrom django.conf.urls import url  \nfrom django.contrib import admin  \nfrom django_restful_admin import admin as api_admin  \nfrom django.urls import path  \n\n  \nurlpatterns = [  \n  path('apiadmin/', api_admin.site.urls),  # this line added\n  # path('admin/', admin.site.urls),\n  # your apis custom must be set here  \n]\n```\n\nRegister your model to restful admin site in `blog/admin.py`\n\n```\nfrom django_restful_admin import admin as api_admin  \nfrom blog.models import *    \n  \napi_admin.site.register(Post) \napi_admin.site.register(Category) \n```\n \nAdd View and use decorators `blog/admin.py`\n```\n...\n@api_admin.register(Category, Product)  \nclass MyCustomApiAdmin(BaseRestFulModelAdmin):  \n    authentication_classes = (CustomTokenAuthentication,)\n\tpermission_classes = [IsAuthenticated] \n... \n```\nRead more about authentication and permission DRF [Documentation](https://www.django-rest-framework.org/api-guide/authentication/#authentication).\n\n## Customize serialization\nAt first, you must define your serializer class \nMake `serializers.py` file in `blog`\nOpen `blog/serializers.py` and make serializer like this:\n\n```\nfrom rest_framework import serializers\nfrom .models import *\nclass ProductSerializer(serializers.ModelSerializer):\n\tclass Meta:\n\t\tmodel = Product\n\t\tfeilds = ('id', 'title')\nclass CategorySerializer(serializers.ModelSerializer):\n\tclass Meta:\n\t\tmodel = Category\n\t\tfields = ('id','title)\n\t\t\nclass SingleProductSerializer(serializers.ModelSerializer):\n\tcategory = CategorySerializer(read_only=True)\n\tclass Meta:\n\t\tmodel = Product\n\t\tfeilds = ('id', 'title', 'summery', 'description', 'category')\n```\n```\nfrom .serializers import ProductSerializer, SingleProductSerializer\n@api_admin.register(Product)  \nclass ProductApiAdmin(BaseRestFulModelAdmin):  \n    serializer_class = ProductSerializer\n    single_serializer_class = SingleProductSerializer\n```\n`serializer_class` use for serialize list of objects but  `single_serializer_class` use for serializer **view signle object**, **update**, **partial update** and **create**.\n\n## Add a custom route with permission\n```\n@api_admin.register(Product)  \nclass MyCustomApiAdmin(BaseRestFulModelAdmin):\n\n\t@api_admin.action(permission='product.view_product', detail=True, methods=['GET'], url_path=r'my-custom-action/(?P\u003canother_key\u003e[^/.]+)')  \n\tdef my_custom_action(self, request, pk, another_key):\n\t\tpass\n\t\t## Do what you want to do\n\t\t## this action make url like this /apiadmin/blog/product/2/my-custom-action/XXX\n```\nIf you want to except permission you just send permission=True, for creating custom permission you can pass **closure function** or **lambda** to permission like this `permission=lambda: view, action, request, obj=None: True`\n  \n# Contribute  \nIf you think you can help me please let's start.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirasaran%2Fdjango-restful-admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirasaran%2Fdjango-restful-admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirasaran%2Fdjango-restful-admin/lists"}