DRF Generic Views
A set of generic views for Django REST Framework.
Installation
- Install the package using pip:
pip install drf-generic-views
- Add
drf_generic_viewstoINSTALLED_APPS
INSTALLED_APPS = [
...,
"drf_generic_views",
]
Usage
Mixins
MultiDestroyModelMixin
A mixin for multiple deletion of objects. It provides a destroy method that deletes all objects in the queryset individually.
It also provides a deletion hook `perform_destroy. It is called with the instance just before it should be deleted.
def perform_destroy(self, instance):
instance.delete()
BulkDestroyModelMixin
A mixin for bulk deletion of objects. It provides a destroy method that deletes all objects in the queryset with a bulk delete.
It also provides a deletion hook perform_destroy. It is called with the queryset just before all objects should be deleted.
def perform_destroy(self, queryset):
queryset.delete()
Generic Views
BulkDestroyAPIView
A view for bulk deletion of objects. It deletes all objects in the queryset with a bulk delete.
from drf_generic_views.generics import BulkDestroyAPIView
class MyBulkDestroyView(BulkDestroyAPIView):
queryset = MyModel.objects.all()
ListDestroyAPIView
A view for deleting multiple objects individually from the queryset.
from drf_generic_views.generics import ListDestroyAPIView
class MyListDestroyView(ListDestroyAPIView):
queryset = MyModel.objects.all()
ListBulkDestroyAPIView
A view for both list and bulk deletion of objects.
from rest_framework.generics import ListAPIView
from drf_generic_views.generics import ListBulkDestroyAPIView
class MyListBulkDestroyView(ListBulkDestroyAPIView):
queryset = MyModel.objects.all()
--
Contributing
Contributions are more than welcome! Please open an issue if you have any questions or suggestions.
Metadata
Release files for drf-generic-views 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drf_generic_views-0.2.tar.gz | 3.6 kB | Without provenance | Details for drf_generic_views-0.2.tar.gz |
Release files / drf_generic_views-0.2.tar.gz
| Download URL | drf_generic_views-0.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5b31516b9feb2a503ca9c7bc03261d2c999b0b607c43cc74ea91b6fd257f511
|
|
BLAKE2b-256 checksum How to use checksums |
7eda08d83c2be5fe8f522b65d6bb269cab5492a50394fb85be96439b8f9a9139
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for drf-generic-views 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.