prelude:
Here\'s the simpliest way to display an ImageField. Lets assume I have 10 fields in my form and I don\'t wanna iterate over all of them in
As Selcuk mentioned the simplest solution was to create my own widget.
from string import Template
from django.utils.safestring import mark_safe
from django.forms import ImageField
class PictureWidget(forms.widgets.Widget):
def render(self, name, value, attrs=None, **kwargs):
html = Template("""""")
return mark_safe(html.substitute(link=value))
class UserProfileForm(forms.ModelForm):
photo = ImageField(widget=PictureWidget)