Skip to main content

A Django utility suite with additional features

Project description

Django Utility Suite

Description

django_utility_suite is a set of utilities to enhance Django development

Installation

You can install this package with:

pip install django-utility-suite

Or if you use Poetry:

poetry add django-utility-suite

Usage

Django Configuration

Add django_utility_suite to INSTALLED_APPS in your settings.py:

INSTALLED_APPS = [
    ...
    'django_utility_suite',
]

Package utils

1. Performance optimization and cache management.

Using ReadOnlyViewSetMixin

This mixin provides an optimized way to handle caching in read-only views.

from django_utility_suite.api.mixins import ReadOnlyViewSetMixin
from rest_framework.viewsets import ReadOnlyModelViewSet
from .models import MyModel
from .serializers import MyModelSerializer

class MyModelViewSet(ReadOnlyViewSetMixin, ReadOnlyModelViewSet):
    queryset = MyModel.objects.all()
    serializer_class = MyModelSerializer
    
    def get_cache_key(self):
        if self.action == "retrieve":
            return f"mimodel-retrieve-{self.lookup_field}"
        elif self.action == "list":
            return f"mimodel-list"
    
    @property
    def cache_prefix(self):
        return "my_model"

Development

If you want to contribute, clone the repository and use Poetry to manage dependencies:

git clone https://github.com/yourusername/django-utility-suite.git
cd django-utility-suite
poetry install

License

This project is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_utility_suite-0.1.5.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_utility_suite-0.1.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file django_utility_suite-0.1.5.tar.gz.

File metadata

  • Download URL: django_utility_suite-0.1.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/5.15.154+

File hashes

Hashes for django_utility_suite-0.1.5.tar.gz
Algorithm Hash digest
SHA256 9ef101dc62f5c4a564dcb4ddf179baa6f57fcb9786225d30ec0bdbc9d0a24a58
MD5 3051313a1dc302a8e2ea81a498b418f6
BLAKE2b-256 3f08b6627aee04e95ee54a7a693090495fa7ebb9d37dc87412fab3f7a8c9d364

See more details on using hashes here.

File details

Details for the file django_utility_suite-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_utility_suite-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4909c40c0e2e2260f384cb1895b885ca0b42391abdbcb99da7a6293f846cbf91
MD5 246c23aef393a04f67d77d7ec8041475
BLAKE2b-256 c4b93b3f845c457bb6c0cb89e5e3910e9ed9295c9c51e35fe31a272a70f5971a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page