Skip to main content

Default static file path for Django ImageField

Setup

  • install it via pip install django-default-imagefield

  • add it to your settings and it auto-registers itself

    settings.INSTALLED_APPS = [
       ...
       'django_fields',
       ...
    ]

Usage

  • add field to your model class

    from django_fields import DefaultStaticImageField
    
    class Post(models.Model):
      photo = DefaultStaticImageField(blank=True)
  • default path is django_fields/no_image.png and is included in the package. you can change it via settings.py

    # settings.py
    DEFAULT_IMAGE_PATH = 'images/custom_no_image.png'
  • or add field attribute default_image_path

    class Post(models.Model):
      photo = DefaultStaticImageField(blank=True, default_image_path='images/blank.png')
  • if there is no file in the default_image_path of the field or DEFAULT_IMAGE_PATH in settings.py, use the default image built into the package.

  • if deploying to a production environment, you must run the ./manage.py collectstatic command to copy the image files included in the package to the static file serving path.

Contributing

As an open source project, we welcome contributions.

The code lives on github.

Metadata

Release files for django-default-imagefield 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-default-imagefield 0.5.5
File Size Uploaded Provenance Actions
django-default-imagefield-0.5.5.tar.gz 27.2 kB Without provenance Details for django-default-imagefield-0.5.5.tar.gz

Release files / django-default-imagefield-0.5.5.tar.gz

Download URL django-default-imagefield-0.5.5.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ff24240132526331a5631d6f65b487102bf9bc0ade6984962fbe2389f281580c
BLAKE2b-256 checksum
How to use checksums
b5eee18d2e923243bbc993ffc7befe1987eed60e555442f13b35836014ae09d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Security for django-default-imagefield 0.5.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page