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.
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-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57610ffedc8719cea9f48cc9fe69e249e1085bbc398c2297ff379e1f6d82491e |
|
MD5 | c0958cbf1b60304a8c9231e8e0bd42da |
|
BLAKE2b-256 | 9bca01fb2e3a94a9f7c599ca74139dc49d1540e2977f95712e638b78ee5dff97 |
Close
Hashes for django_svg_image_form_field-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fd889c800d8d7de421fa92fe6625cc36975d29159e2b498759bc7720f0e4942 |
|
MD5 | 39fa68fb860cf04bde2f4d47c4357f32 |
|
BLAKE2b-256 | a66393a07bcf2a53a45e561fb4e5342829576b8f2b6c58fb4a4c4f5316a74357 |