A form field to handle validation of image + svg
Project description
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-svg-image-form-field-1.0.1.tar.gz
.
File metadata
- Download URL: django-svg-image-form-field-1.0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 396430e4ed6577cdd2858f06654084030f477a31efc43453f13d07023136dbc1 |
|
MD5 | 9154f61820c8aa46a4cfcf104e65a26a |
|
BLAKE2b-256 | 887a270068010e8c0e6be5f710786d8ff88e323f8b8b41f8c672dcf16bce9cab |
File details
Details for the file django_svg_image_form_field-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_svg_image_form_field-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06944dfda41e6fd7f7179acb16c04001eeeb873ffada8c8e88d1b7eb5d3ce766 |
|
MD5 | a8f550754fcc685d4bc38cfea3cbf8da |
|
BLAKE2b-256 | d7ca28264123b37ff43698073993d7481adc0af1215a41488b0bac13c70d6e27 |