Reusable multiple file upload for Django admin in new UI style. Compatible with Django's default admin, Jazzmin, and Grappelli admin interfaces.
Project description
django-admin-multiupload
Reusable multiple file upload for Django admin in new UI style. Compatible with Django's default admin, Jazzmin, and Grappelli admin interfaces. Install the package and use the mixins in your admin classes — the templates, CSS, and JS are bundled so you do not have to wire up static files manually.
Examples
Default Django Admin
Jazzmin Theme
Grappelli Theme
Installation
# with uv
uv add django-admin-multiupload
# or pip
pip install django-admin-multiupload
Add the app to INSTALLED_APPS so Django can discover the bundled templates and static assets:
INSTALLED_APPS = [
# ...
"django_admin_multiupload",
]
Usage
models.py
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
price = models.DecimalField(max_digits=10, decimal_places=2)
def __str__(self):
return self.name
class ProductImage(models.Model):
product = models.ForeignKey(
Product, on_delete=models.CASCADE, related_name="images"
)
image = models.ImageField(upload_to="product_images")
def __str__(self):
return self.product.name
class ProductFile(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name="files")
file = models.FileField(upload_to="product_files")
def __str__(self):
return self.product.name
admin.py
from django.contrib import admin
from django_admin_multiupload import MultipleUploadAdminMixin, MultipleUploadInlineMixin
from .models import Product, ProductFile, ProductImage
class ProductImageInline(MultipleUploadInlineMixin, admin.TabularInline):
model = ProductImage
extra = 1
upload_field_name = "image"
class ProductFileInline(MultipleUploadInlineMixin, admin.TabularInline):
model = ProductFile
extra = 1
upload_field_name = "file"
@admin.register(Product)
class ProductAdmin(MultipleUploadAdminMixin, admin.ModelAdmin):
list_display = ("name", "price")
search_fields = ("name", "description")
inlines = [ProductImageInline, ProductFileInline]
That is it. The admin change form will render the drag-and-drop upload area and load the package's CSS/JS automatically.
How It Works
- Add
MultipleUploadInlineMixinto your inline class and specifyupload_field_name - Add
MultipleUploadAdminMixinto your ModelAdmin class that uses the inline - The mixin automatically detects if the field is an ImageField or FileField
- Files are uploaded and saved automatically when you save the parent object
License
Released under MIT License.
Supporting
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_admin_multiupload-0.1.3.tar.gz.
File metadata
- Download URL: django_admin_multiupload-0.1.3.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cc5d1177f196de0da07cc7e9ce549f5d0f002b1259c080e317bf888d3fd135
|
|
| MD5 |
a0de50da6975ea40bc8e8b46c5a11fe6
|
|
| BLAKE2b-256 |
fd792180abbcc97249ba7f89060c7dee82a16c77d159414add0c73b459af552d
|
File details
Details for the file django_admin_multiupload-0.1.3-py3-none-any.whl.
File metadata
- Download URL: django_admin_multiupload-0.1.3-py3-none-any.whl
- Upload date:
- Size: 81.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a5291c4218bc891c663c43b92713127f52750394b32b233ed7e1c216007120f
|
|
| MD5 |
6046db45f71beb7a0e53442abb0c8299
|
|
| BLAKE2b-256 |
3ed85680b5549ddf4d36c628528be8746b86c253bf76dbba42a5be9a964f40ec
|