Skip to main content

Essential utilities for Django

Project description

Django Essentials

Essential utilities for Django that make common tasks easier and more efficient.

Features

  • Admin Utilities: Enhanced admin interface components including FancyBox image display
  • Model Utilities: Helper functions for common model operations

Installation

pip install django-essentials-kit

Quick Start

Admin Utilities

The library provides MediaFancybox class and get_fancybox_image function for enhanced image display in Django admin:

from django.contrib import admin
from django_essentials_kit.admin import MediaFancybox, get_fancybox_image
from .models import YourModel

@admin.register(YourModel)
class YourModelAdmin(admin.ModelAdmin):
    list_display = ['name', 'image_preview']

    class Media(MediaFancybox):
        ...

    def image_preview(self, obj) -> SafeString:
        return get_fancybox_image(obj, 'image_field', w=60, h=60)

Model Utilities

Use get_object_or_none for safe object retrieval:

from django_essentials_kit.utils import get_object_or_none

from .models import YourModel

# Instead of try/except blocks
obj = get_object_or_none(YourModel, pk=1)
if obj:
    ...  # Do something with obj

Requirements

  • Python 3.8+
  • Django 3.2+

License

MIT License - see LICENSE file for details.

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_essentials_kit-0.1.1.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_essentials_kit-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file django_essentials_kit-0.1.1.tar.gz.

File metadata

  • Download URL: django_essentials_kit-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for django_essentials_kit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2f113c85d5e2ff617560e08628108f11fdf277e751d3341e5311650833e4902
MD5 509a7a15ebd5348508671d6efe287dfb
BLAKE2b-256 07add0316b9e2488e3bd74b62598d2e36e2c7f2157a95ba618dd53c151c28dff

See more details on using hashes here.

File details

Details for the file django_essentials_kit-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_essentials_kit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a235a665898155e2d2afadcfb7e29fee84dc77ef6985162f4f223ceb6201d20e
MD5 fbcb5c8a2fb4bbe8ff1379af2c9d4c4d
BLAKE2b-256 2db7fe2dfeb72ebe6815524eb2fee689fda61093175113e61e051e23d7b4ed80

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