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

Required field showing clear checkbox and allowing value to be None

Open alstr opened this issue 5 years ago • 0 comments

I notice in #14 a fix was provided to stop showing the clear checkbox when a VersatileImageField is required.

However, I am seeing the clear checkbox in the admin change form, despite my field being required.

class Photo(models.Model):
    image = VersatileImageField('Image', upload_to='media/uploads/gallery', ppoi_field='image_ppoi')
    image_ppoi = PPOIField('Image PPOI')

Please correct me if I am missing something, but I've kept everything relatively simple and as far as I understand it the checkbox should not appear in my case.

The field seems to be allowing the image to be None despite not specifying null=True, as the below fails:

def test_empty_image(self):
    """Test empty image."""
    photo = create_photo()
    photo.image = None
    self.assertRaises(IntegrityError, photo.save)

alstr avatar May 15 '19 15:05 alstr