šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

django-svg-image-form-field

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-svg-image-form-field

A form field to handle validation of image + svg

1.0.1
PyPI
Maintainers
1

============================= Django SVG Image Field

.. image:: https://badge.fury.io/py/django-svg-image-form-field.svg :target: https://badge.fury.io/py/django-svg-image-form-field

A form field to handle validation of image + svg

Quickstart

Install Django SVG Image Field::

pip install django-svg-image-form-field

Models:

.. code-block:: python

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:

.. code-block:: python

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:

.. code-block:: python

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:

  • Cookiecutter_
  • cookiecutter-djangopackage_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter-djangopackage: https://github.com/pydanny/cookiecutter-djangopackage

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_).

.. _fbuccioni: https://github.com/fbuccioni

Keywords

django

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts