{"id":24268276,"url":"https://github.com/apkawa/django-multitype-file-field","last_synced_at":"2025-07-01T22:06:53.434Z","repository":{"id":57420974,"uuid":"64459731","full_name":"Apkawa/django-multitype-file-field","owner":"Apkawa","description":"For possible use one field for different file type","archived":false,"fork":false,"pushed_at":"2021-07-28T18:05:14.000Z","size":38,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T04:37:10.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Apkawa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-29T07:21:01.000Z","updated_at":"2021-07-28T18:05:17.000Z","dependencies_parsed_at":"2022-09-04T01:42:05.034Z","dependency_job_id":null,"html_url":"https://github.com/Apkawa/django-multitype-file-field","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Apkawa/django-multitype-file-field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-multitype-file-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-multitype-file-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-multitype-file-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-multitype-file-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apkawa","download_url":"https://codeload.github.com/Apkawa/django-multitype-file-field/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fdjango-multitype-file-field/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260816785,"owners_count":23067374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-15T13:35:03.390Z","updated_at":"2025-06-19T19:36:10.923Z","avatar_url":"https://github.com/Apkawa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ci](https://github.com/Apkawa/django-multitype-file-field/actions/workflows/ci.yml/badge.svg)](https://github.com/Apkawa/django-multitype-file-field/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/Apkawa/django-multitype-file-field/branch/master/graph/badge.svg)](https://codecov.io/gh/Apkawa/django-multitype-file-field)\n\n[![PyPi ](https://img.shields.io/pypi/v/django-multitype-file-field.svg)](https://pypi.python.org/pypi/django-multitype-file-field)\n[![PyPi python versions](https://img.shields.io/pypi/pyversions/django-multitype-file-field.svg)](https://pypi.python.org/pypi/django-multitype-file-field)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nProject for merging different file types, as example easy thumbnail image and unpacking archive in one field\n\n# Installation\n\n```bash\npip install django-multitype-file-field\n\n```\n\nor from git\n\n```bash\npip install -e git+https://github.com/Apkawa/django-multitype-file-field.git#egg=django-multitype-file-field\n```\n\n## Django and python version\n\n| Python\u003cbr/\u003eDjango |        3.5         |      3.6           |      3.7           |       3.8          |\n|:-----------------:|--------------------|--------------------|--------------------|--------------------|\n| 1.8               |       :x:          |      :x:           |       :x:          |      :x:           |\n| 1.11              | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |      :x:           |\n| 2.2               | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n| 3.0               |       :x:          | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |\n\n\n# Usage\n\n## models.py\n\n```python\nfrom django.db import models\n\nfrom multitype_file_field.fields import MultiTypeFileField\n\n# as example, with easy_thumbnails\nfrom easy_thumbnails.fields import ThumbnailerImageField\n\n\nclass FileModel(models.Model):\n    file = MultiTypeFileField(upload_to='test_archive',\n        fields={\n            None: models.FileField, # Fallback\n            'image/svg+xml': models.FileField, # high priority,\n            'image': (\n                ThumbnailerImageField, \n                dict(resize_source=dict(size=(100, 100), sharpen=True, crop='smart'))\n                ), # tuple, Field and args\n            \n        }\n    )\n```\nUsage:\n\n```python\nfrom tests.models import TestModel\nfrom django.core.files.base import ContentFile\nmodel = TestModel()\nmodel.file # =\u003e \u003cFieldFile: None\u003e\nmodel.file = ContentFile('', name='example.png')\nmodel.file # =\u003e \u003cImageFieldFile: example.png\u003e\nmodel.file = ContentFile('', name='example.txt')\nmodel.file # =\u003e \u003cFieldFile: example.txt\u003e\n\n```\n\n# Contributing\n\n## run example app\n\n```bash\npip install -r requirements-dev.txt\n./test/manage.py migrate\n./test/manage.py runserver\n```\n\n## run tests\n\n```bash\npip install -r requirements-dev.txt\npytest\ntox\n```\n\n## Update version\n\n```bash\npython setup.py bumpversion\n```\n\n## publish pypi\n\n```bash\npython setup.py publish\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fdjango-multitype-file-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapkawa%2Fdjango-multitype-file-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fdjango-multitype-file-field/lists"}