django-versatileimagefield icon indicating copy to clipboard operation
django-versatileimagefield copied to clipboard

The VersatileImageField outlook.

Open AirChen opened this issue 8 years ago • 0 comments

2017-10-01 5 11 20

I want to have a good look interface,but VersatileImageField same as ImageField. It's my code:

from django.db import models
from versatileimagefield.fields import VersatileImageField, PPOIField
from versatileimagefield.placeholder import OnStoragePlaceholderImage

class ImageExampleModel(models.Model):
    name = models.CharField(
        'Name',
        max_length=80
    )
    image = VersatileImageField(
        'Image',
        upload_to='images/testimagemodel/',
        width_field='width',
        height_field='height',
        ppoi_field='ppoi'
    )
    height = models.PositiveIntegerField(
        'Image Height',
        blank=True,
        null=True
    )
    width = models.PositiveIntegerField(
        'Image Width',
        blank=True,
        null=True
    )
    optional_image = VersatileImageField(
        'Optional Image',
        upload_to='images/testimagemodel/optional/',
        blank=True,
        placeholder_image=OnStoragePlaceholderImage(
            path='images/bear.jpg'
        )
    )
    ppoi = PPOIField()

    class Meta:
        verbose_name = 'Image Example'
        verbose_name_plural = 'Image Examples'

AirChen avatar Oct 01 '17 09:10 AirChen