A form field to handle validation of image + svg
Quickstart
Install Django SVG Image Field:
pip install django-svg-image-form-field
Models:
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=100)
image = models.ImageField(upload_to='images/articles')
text = models.TextField()
Forms:
from django import forms
from .models import Article
from django_svg_image_form_field import SvgAndImageFormField
class ArticleForm(forms.ModelForm):
class Meta:
model = Article
exclude = []
field_classes = {
'image': SvgAndImageFormField,
}
Example usage:
from django.contrib import admin
from .forms import ArticleForm
from .models import Article
@admin.register(Article)
class SectionAdmin(admin.ModelAdmin):
list_display = 'id', 'title'
search_fields = 'title',
form = ArticleForm
Credits
Tools used in rendering this package:
History
0.1.0 (2021-04-15)
First release on PyPI.
1.0.0 (2021-04-15)
Stable version (tested on demo project).
1.0.1 (2021-06-14)
Fix when the input is the temporary file path instead the BytesIO (thanks fbuccioni).
Metadata
Release files for django-svg-image-form-field 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-svg-image-form-field-1.0.1.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_svg_image_form_field-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / django-svg-image-form-field-1.0.1.tar.gz
| Download URL | django-svg-image-form-field-1.0.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
396430e4ed6577cdd2858f06654084030f477a31efc43453f13d07023136dbc1
|
|
BLAKE2b-256 checksum How to use checksums |
887a270068010e8c0e6be5f710786d8ff88e323f8b8b41f8c672dcf16bce9cab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Release files / django_svg_image_form_field-1.0.1-py2.py3-none-any.whl
| Download URL | django_svg_image_form_field-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
06944dfda41e6fd7f7179acb16c04001eeeb873ffada8c8e88d1b7eb5d3ce766
|
|
BLAKE2b-256 checksum How to use checksums |
d7ca28264123b37ff43698073993d7481adc0af1215a41488b0bac13c70d6e27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|