AIDA-CRUD
Advanced Intelligent Django API CRUD Framework
A comprehensive, DRY solution for building feature-rich CRUD operations in Django REST Framework applications.
Installation
pip install aida-crud
Quick Start
1. Add to Django Settings
INSTALLED_APPS = [
# ...
'rest_framework',
'django_filters',
'aida_crud',
]
2. Create Your Models
from aida_crud.core import SoftDeleteModel
class Product(SoftDeleteModel):
name = models.CharField(max_length=200)
price = models.DecimalField(max_digits=10, decimal_places=2)
class Meta:
ordering = ['-created_at']
3. Create Serializers
from aida_crud.serializers import AidaModelSerializer
class ProductSerializer(AidaModelSerializer):
class Meta:
model = Product
fields = '__all__'
4. Create ViewSets
from aida_crud.viewsets import AidaModelViewSet
class ProductViewSet(AidaModelViewSet):
queryset = Product.objects.all()
serializer_class = ProductSerializer
search_fields = ['name', 'description']
ordering_fields = '__all__'
Features
Backend Capabilities
- ✅ Generic ViewSets - Automatic CRUD operations with minimal code
- ✅ Dynamic Serializers - Context-aware field selection and expansion
- ✅ Advanced Filtering - Built-in search, ordering, and filtering
- ✅ Bulk Operations - Create, update, and delete multiple records
- ✅ Soft Delete - Safe deletion with restore capabilities
- ✅ Audit Trail - Comprehensive activity logging
- ✅ Data Export - CSV, JSON, and Excel export support
- ✅ API Metadata - Auto-configuration endpoints for frontends
Built-in Endpoints
Each ViewSet automatically provides:
GET /api/resource/- List with paginationPOST /api/resource/- Create new itemGET /api/resource/{id}/- Retrieve itemPUT/PATCH /api/resource/{id}/- Update itemDELETE /api/resource/{id}/- Soft delete itemPOST /api/resource/bulk-create/- Bulk createPOST /api/resource/bulk-update/- Bulk updatePOST /api/resource/bulk-delete/- Bulk deleteGET /api/resource/export/- Export dataOPTIONS /api/resource/metadata/- Get metadata
Advanced Usage
Custom Filters
from aida_crud.filters import AidaFilterSet
class ProductFilterSet(AidaFilterSet):
min_price = django_filters.NumberFilter(field_name='price', lookup_expr='gte')
max_price = django_filters.NumberFilter(field_name='price', lookup_expr='lte')
class Meta:
model = Product
fields = ['name', 'category', 'is_active']
Audit Logging
from aida_crud.audit import AuditLog
# Automatic logging in ViewSets
class ProductViewSet(AidaModelViewSet):
# All CRUD operations are automatically logged
pass
# Manual logging
AuditLog.log_action(
user=request.user,
action='CUSTOM_ACTION',
obj=product,
changes={'price': {'old': 100, 'new': 150}}
)
Bulk Operations
# In your ViewSet
class ProductViewSet(AidaModelViewSet):
bulk_actions = ['archive', 'activate', 'deactivate']
def bulk_archive(self, queryset, **kwargs):
count = queryset.update(is_archived=True)
return {'archived': count}
Configuration
ViewSet Options
class MyViewSet(AidaModelViewSet):
# Display configuration
list_display = ['name', 'price', 'created_at']
list_filter = ['category', 'is_active']
search_fields = ['name', 'description']
ordering_fields = '__all__'
ordering = ['-created_at']
# Bulk operations
bulk_actions = ['delete', 'archive', 'activate']
# Export configuration
export_formats = ['csv', 'json', 'xlsx']
export_fields = ['name', 'price', 'category']
# Computed fields
computed_fields = {
'display_price': lambda obj: f'${obj.price:.2f}'
}
Requirements
- Python 3.8+
- Django 3.2+
- Django REST Framework 3.12+
- django-filter 2.4+
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please visit our GitHub repository.
Support
For issues and questions, please use our GitHub Issues.
Metadata
Release files for aida-crud 1.0.1
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 | |
|---|---|---|---|---|
| aida_crud-1.0.1.tar.gz | 19.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aida_crud-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.4 kB
Release files / aida_crud-1.0.1.tar.gz
| Download URL | aida_crud-1.0.1.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24e2c64ea3bc1c9b317de5e4b27a906baa7a2a2b47f3e02247971428c295db7d
|
|
BLAKE2b-256 checksum How to use checksums |
bb99f76bc7c2946cef6ead47e45a167e61fc01af5dadc12909583a4762e24d58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Release files / aida_crud-1.0.1-py3-none-any.whl
| Download URL | aida_crud-1.0.1-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21d20f01b3cfec18dd83faa39027842dcaad4ac0c15551610b2201ecf3a7456c
|
|
BLAKE2b-256 checksum How to use checksums |
d4753ef82bad9fd4ae63911fbc880482d1f129bf0024c52d53dd55ff932413d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.3
|
Security for aida-crud 1.0.1
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.