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.3.tar.gz (7.4 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.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_essentials_kit-0.1.3.tar.gz
  • Upload date:
  • Size: 7.4 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.3.tar.gz
Algorithm Hash digest
SHA256 31d195af77532d68827aa97a6bef83f9d0c8208624ed6380c451abdcc7b09ad4
MD5 f3ce523e221bc0c2eb6d9d4bc34b2e83
BLAKE2b-256 f97edbd03ccc1126059ea268d18f4bf427e05fc74103c676f718fef350cb6db6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_essentials_kit-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 718c5a31aaf5da2fe01783acf3e58e071dd9dfb99e0170b946165e962f8f342a
MD5 299fe2c446f5adad1e7ea6aa23822b1d
BLAKE2b-256 91ef6948b761f59b3ad3afe7a3e3de31789539fcf03d0fdb27c216c7be23c4db

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