Skip to main content

Attachments management app for django

Project description

version downloads license

Django application to manage attached files to any django model.

Install

pip install django_attachments_management

Configure

Add ‘django_attachments’ to INSTALLED_APPS.

Usage

Add GalleryField or LibraryField to django model.

from django.db import models
from django_attachments.fields import LibraryField, GalleryField


class Article(models.Model):
        title = models.CharField(max_length=100)
        attachments = LibraryField(related_name='articles_with_attachment', on_delete=models.CASCADE)
        gallery = GalleryField(related_name='articles_with_gallery', on_delete=models.CASCADE)

Use AttachmentsAdminMixin to enable attachments in admin interface.

from django.contrib import admin

from .models import Article
from django_attachments.admin import AttachmentsAdminMixin


class ArticleAdmin(AttachmentsAdminMixin, admin.ModelAdmin):
        pass


admin.site.register(Article, ArticleAdmin)

Screenshots

https://raw.github.com/wiki/mireq/django-attachments/django_attachments.png?v2022-12-11

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_attachments_management-1.1.2.tar.gz (57.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

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