{"id":13814142,"url":"https://github.com/Chive/django-multiupload","last_synced_at":"2025-05-15T03:33:00.235Z","repository":{"id":18347313,"uuid":"21527116","full_name":"Chive/django-multiupload","owner":"Chive","description":"Dead simple drop-in multi file upload field for Django forms using HTML5's multiple attribute.","archived":false,"fork":false,"pushed_at":"2022-03-16T11:05:15.000Z","size":55,"stargazers_count":280,"open_issues_count":6,"forks_count":81,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-01T21:46:13.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"viezel/NappDownloadManager","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-07-05T19:50:12.000Z","updated_at":"2024-10-09T04:04:15.000Z","dependencies_parsed_at":"2022-08-07T13:15:08.392Z","dependency_job_id":null,"html_url":"https://github.com/Chive/django-multiupload","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chive%2Fdjango-multiupload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chive%2Fdjango-multiupload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chive%2Fdjango-multiupload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chive%2Fdjango-multiupload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chive","download_url":"https://codeload.github.com/Chive/django-multiupload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225326415,"owners_count":17456936,"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":"2024-08-04T04:01:45.070Z","updated_at":"2024-11-19T09:30:26.493Z","avatar_url":"https://github.com/Chive.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Django Multiupload\n\n[![Build Status](https://travis-ci.org/Chive/django-multiupload.svg?branch=master)](https://travis-ci.org/Chive/django-multiupload)\n\n\nDead simple drop-in multi file upload field for django forms using HTML5's ``multiple`` attribute.\n\n## Installation\n\n* Install the package using pip (or easy_install if you really have to)\n\n```bash\n$ pip install django-multiupload\n```\n\n* Or directly from this repository to get the development version (if you're feeling adventurous)\n\n```bash\n$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload\n```\n\n## Usage\n\nAdd the form field to your form and make sure to save the uploaded files in the form's ``save`` method.\n\nFor more detailed examples visit the [examples section](https://github.com/Chive/django-multiupload/tree/master/examples).\n\n\n```python\n# forms.py\nfrom django import forms\nfrom multiupload.fields import MultiFileField, MultiMediaField, MultiImageField\n\nclass UploadForm(forms.Form):\n    attachments = MultiFileField(min_num=1, max_num=3, max_file_size=1024*1024*5)\n\n    # If you need to upload media files, you can use this:\n    attachments = MultiMediaField(\n        min_num=1,\n        max_num=3,\n        max_file_size=1024*1024*5,\n        media_type='video'  # 'audio', 'video' or 'image'\n    )\n\n    # For images (requires Pillow for validation):\n    attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5)\n```\n\nThe latter two options just add fancy attributes to HTML's `\u003cinput\u003e`, restricting the scope to corresponding filetypes.\n\n```python\n# models.py\nfrom django.db import models\n\nclass Attachment(models.Model):\n    file = models.FileField(upload_to='attachments')\n\n```\n\n```python\n# views.py\nfrom django.views.generic.edit import FormView\nfrom .forms import UploadForm\nfrom .models import Attachment\n\nclass UploadView(FormView):\n    template_name = 'form.html'\n    form_class = UploadForm\n    success_url = '/done/'\n\n    def form_valid(self, form):\n        for each in form.cleaned_data['attachments']:\n            Attachment.objects.create(file=each)\n        return super(UploadView, self).form_valid(form)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChive%2Fdjango-multiupload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChive%2Fdjango-multiupload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChive%2Fdjango-multiupload/lists"}