Skip to main content

App for Django featuring improved form base classes.

Project description

[![Build Status](](

[![Requirements Status](](

Project for merging different file types, as example easy thumbnail image and unpacking archive in one field

# Installation

pip install django-multitype-file-field


or from git

pip install -e git+

# Usage


from django.db import models

from multitype_file_field.fields import MultiTypeFileField

# as example, with easy_thumbnails
from easy_thumbnails.fields import ThumbnailerImageField

class FileModel(models.Model):
file = MultiTypeFileField(upload_to='test_archive',
None: models.FileField, # Fallback
'image/svg+xml': models.FileField, # high priority,
'image': (
dict(resize_source=dict(size=(100, 100), sharpen=True, crop='smart'))
), # tuple, Field and args

from tests.models import TestModel
from django.core.files.base import ContentFile
model = TestModel()
model.file # => <FieldFile: None>
model.file = ContentFile('', name='example.png')
model.file # => <ImageFieldFile: example.png>
model.file = ContentFile('', name='example.txt')
model.file # => <FieldFile: example.txt>


# Contributing

## run tests

pip install -r requirements.txt
./test/ migrate

## publish pypi

python sdist upload -r pypi

Project details

Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-multitype-file-field-0.0.4.tar.gz (2.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page