Skip to content

LucasCTN/django-remote-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django-remote-image

PyPI

Django-remote-image is a Django app that adds a new form field for images. The default widget is a text input, that accepts a URL of a image.

The image is downloaded and can be passed to a ImageField in a model. Pillow needs to be installed.

It is possible to whitelist and blacklist file extensions.

Examples are shown below.

Quick start

$ pip install Pillow
$ pip install django-remote-image

Using

Django-remote-image adds a new form field named RemoteImageField that can be used to download images from a URL.

Examples

Using the field RemoteImageField in a form (all image extensions allowed):

from remote_image import RemoteImageField

class ExampleForm(forms.Form):
   image = RemoteImageField()

Whitelisting file extensions (the ones NOT included in the list will raise a validation error message):

from remote_image import RemoteImageField

class ExampleForm(forms.Form):
    image = RemoteImageField(ext_whitelist=['png', 'jpg'])

Blacklisting file extensions (the ones included in the list will raise a validation error message):

from remote_image import RemoteImageField

class ExampleForm(forms.Form):
    image = RemoteImageField(ext_blacklist=['png', 'jpg'])

About

Custom django form field for downloading images from a URL on a URLInput.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages