jonasundderwolf / django-image-cropping

Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.
Other
553 stars 131 forks source link

Problem for load the image in the form #52

Closed joannadal closed 9 years ago

joannadal commented 9 years ago

I am trying to put the image into the form page, but I can't.

I am using this code:

forms.py:

from image_cropping import ImageCropWidget

class UserEditForm(forms.ModelForm):

class Meta:
    model = UserProfile
    fields = ( 'image')
    widgets = {
           'image': ImageCropWidget,
    }

html file:

{{ form.media }} {{ form.image }}
jonasvp commented 9 years ago

Can you send your model definition? How did you define the ImageRatioField? Just using the ImageCropWidget is not enough, please refer to the documentation on how to integrate.

joannadal commented 9 years ago

This is the model.py:

class UserProfile(AbstractBaseUser, PermissionsMixin): class Meta: app_label = 'main'

image     = ImageCropField(upload_to=get_file_path_user_photo, null=True, blank=True)
profile_image   = ImageRatioField('image', '200x200')