diff options
Diffstat (limited to 'python-django-multiupload2.spec')
| -rw-r--r-- | python-django-multiupload2.spec | 297 |
1 files changed, 297 insertions, 0 deletions
diff --git a/python-django-multiupload2.spec b/python-django-multiupload2.spec new file mode 100644 index 0000000..0454e92 --- /dev/null +++ b/python-django-multiupload2.spec @@ -0,0 +1,297 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-multiupload2 +Version: 0.5.3 +Release: 1 +Summary: Dead simple drop-in multi file upload field for django forms using HTML5's multiple attribute. +License: LICENSE.txt +URL: https://github.com/Chive/django-multiupload +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/68/ae/8bd9fb5e202d96818de832c6bba207345d21c94bed68cd1e15a52f2ec65e/django-multiupload2-0.5.3.tar.gz +BuildArch: noarch + + +%description +# Django Multiupload + +[](https://travis-ci.org/Chive/django-multiupload) + + +Dead simple drop-in multi file upload field for django forms using HTML5's ``multiple`` attribute. + +## Installation + +* Install the package using pip (or easy_install if you really have to) + +```bash +$ pip install django-multiupload +``` + +* Or directly from this repository to get the development version (if you're feeling adventurous) + +```bash +$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload +``` + +## Usage + +Add the form field to your form and make sure to save the uploaded files in the form's ``save`` method. + +For more detailed examples visit the [examples section](https://github.com/Chive/django-multiupload/tree/master/examples). + + +```python +# forms.py +from django import forms +from multiupload.fields import MultiFileField, MultiMediaField, MultiImageField + +class UploadForm(forms.Form): + attachments = MultiFileField(min_num=1, max_num=3, max_file_size=1024*1024*5) + + # If you need to upload media files, you can use this: + attachments = MultiMediaField( + min_num=1, + max_num=3, + max_file_size=1024*1024*5, + media_type='video' # 'audio', 'video' or 'image' + ) + + # For images (requires Pillow for validation): + attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5) +``` + +The latter two options just add fancy attributes to HTML's `<input>`, restricting the scope to corresponding filetypes. + +```python +# models.py +from django.db import models + +class Attachment(models.Model): + file = models.FileField(upload_to='attachments') + +``` + +```python +# views.py +from django.views.generic.edit import FormView +from .forms import UploadForm +from .models import Attachment + +class UploadView(FormView): + template_name = 'form.html' + form_class = UploadForm + success_url = '/done/' + + def form_valid(self, form): + for each in form.cleaned_data['attachments']: + Attachment.objects.create(file=each) + return super(UploadView, self).form_valid(form) + +``` + +%package -n python3-django-multiupload2 +Summary: Dead simple drop-in multi file upload field for django forms using HTML5's multiple attribute. +Provides: python-django-multiupload2 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-multiupload2 +# Django Multiupload + +[](https://travis-ci.org/Chive/django-multiupload) + + +Dead simple drop-in multi file upload field for django forms using HTML5's ``multiple`` attribute. + +## Installation + +* Install the package using pip (or easy_install if you really have to) + +```bash +$ pip install django-multiupload +``` + +* Or directly from this repository to get the development version (if you're feeling adventurous) + +```bash +$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload +``` + +## Usage + +Add the form field to your form and make sure to save the uploaded files in the form's ``save`` method. + +For more detailed examples visit the [examples section](https://github.com/Chive/django-multiupload/tree/master/examples). + + +```python +# forms.py +from django import forms +from multiupload.fields import MultiFileField, MultiMediaField, MultiImageField + +class UploadForm(forms.Form): + attachments = MultiFileField(min_num=1, max_num=3, max_file_size=1024*1024*5) + + # If you need to upload media files, you can use this: + attachments = MultiMediaField( + min_num=1, + max_num=3, + max_file_size=1024*1024*5, + media_type='video' # 'audio', 'video' or 'image' + ) + + # For images (requires Pillow for validation): + attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5) +``` + +The latter two options just add fancy attributes to HTML's `<input>`, restricting the scope to corresponding filetypes. + +```python +# models.py +from django.db import models + +class Attachment(models.Model): + file = models.FileField(upload_to='attachments') + +``` + +```python +# views.py +from django.views.generic.edit import FormView +from .forms import UploadForm +from .models import Attachment + +class UploadView(FormView): + template_name = 'form.html' + form_class = UploadForm + success_url = '/done/' + + def form_valid(self, form): + for each in form.cleaned_data['attachments']: + Attachment.objects.create(file=each) + return super(UploadView, self).form_valid(form) + +``` + +%package help +Summary: Development documents and examples for django-multiupload2 +Provides: python3-django-multiupload2-doc +%description help +# Django Multiupload + +[](https://travis-ci.org/Chive/django-multiupload) + + +Dead simple drop-in multi file upload field for django forms using HTML5's ``multiple`` attribute. + +## Installation + +* Install the package using pip (or easy_install if you really have to) + +```bash +$ pip install django-multiupload +``` + +* Or directly from this repository to get the development version (if you're feeling adventurous) + +```bash +$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload +``` + +## Usage + +Add the form field to your form and make sure to save the uploaded files in the form's ``save`` method. + +For more detailed examples visit the [examples section](https://github.com/Chive/django-multiupload/tree/master/examples). + + +```python +# forms.py +from django import forms +from multiupload.fields import MultiFileField, MultiMediaField, MultiImageField + +class UploadForm(forms.Form): + attachments = MultiFileField(min_num=1, max_num=3, max_file_size=1024*1024*5) + + # If you need to upload media files, you can use this: + attachments = MultiMediaField( + min_num=1, + max_num=3, + max_file_size=1024*1024*5, + media_type='video' # 'audio', 'video' or 'image' + ) + + # For images (requires Pillow for validation): + attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5) +``` + +The latter two options just add fancy attributes to HTML's `<input>`, restricting the scope to corresponding filetypes. + +```python +# models.py +from django.db import models + +class Attachment(models.Model): + file = models.FileField(upload_to='attachments') + +``` + +```python +# views.py +from django.views.generic.edit import FormView +from .forms import UploadForm +from .models import Attachment + +class UploadView(FormView): + template_name = 'form.html' + form_class = UploadForm + success_url = '/done/' + + def form_valid(self, form): + for each in form.cleaned_data['attachments']: + Attachment.objects.create(file=each) + return super(UploadView, self).form_valid(form) + +``` + +%prep +%autosetup -n django-multiupload2-0.5.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-multiupload2 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.3-1 +- Package Spec generated |
