Image Cropping in template form

211 views
Skip to first unread message

Patrick Sweet

unread,
Apr 4, 2012, 5:16:34 PM4/4/12
to django-users
Hi folks, I'm hoping someone can help me with this. I can't get the image_cropping widget to work in my template.

I've installed django-image-cropping ( https://github.com/jonasundderwolf/django-image-cropping ) and have set up my models appropriately. It works absolutely perfect in the admin, but I can't seem to get it to work with a front-end form in a template.

Digging around for information, I've tried to import image_cropping.widgets and assign the ImageCropWidget to the cropping field, but the form field still shows up as a text input.

FROM Forms.py:

class ProfileForm(forms.ModelForm):
class Meta:
        model = Candidate
        exclude = ('user')
        widgets = {
            'cropping': ImageCropWidget(),
        }

And in my template, I'm calling the form field directly, not "as_p" or "as_table."
FROM form.html:
<div class="bio_field_wrapper">
{{ Form.cropping.errors }}
{{ Form.cropping }}
</div>


Any help would be greatly appreciated.

- Pat
Reply all
Reply to author
Forward
0 new messages