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).
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
Close
Hashes for django-svg-image-form-field-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f1d40eba1f3b44528a332c8116d352b623fa2647605954159bee328fccdbe5d |
|
MD5 | 9df0d151bd7464f78235dfeb076f6058 |
|
BLAKE2b-256 | 181b6faeb7dfdba38dc458ed9b33fa223e5cc04cfae86d7797f2b00410ed41b1 |
Close
Hashes for django_svg_image_form_field-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3246cc00d23c5405f4a3c3461e1c9834900499b054f7132cb98005e13817bb0f |
|
MD5 | 48bfbf8624d8f86714e187aefdaeb6e2 |
|
BLAKE2b-256 | 9469a56009f6fab3dfb0fe09c0e5ba528d27e86a1c516451a64671549ac39c49 |