Hi, I have similar models and wanted to do the same thing. Here's how I got my inline to work (using your provided models as an example).
class Entry(models.Model): pub_date = models.DateTimeField('date published') created = models.DateTimeField(auto_now_add=True, editable=False) edited = models.DateTimeField(auto_now=True, editable=False) title = models.CharField(max_length=200, blank=True) title_fi = models.CharField(max_length=200, blank=True) is_memorial = models.BooleanField('Use special layout?', default=False) class Image(models.Model): entry = models.ForeignKey(Entry, related_name='images') file = models.ImageField(upload_to="%Y") caption = models.TextField() caption_fi = models.TextField() class ImageInline(admin.TabularInline): model = Image extra = 1 class EntryAdmin(admin.ModelAdmin): date_hierachy = 'pub_date' list_display = ('pub_date', 'title') list_filter = ('pub_date',) ordering = ('-pub_date',) search_fields = ('pub_date', 'title') inlines = [ ImageInline, ] ============================ The point is that I didn't need to specify the forms explicitly for the inline. Hope this helps. For reference, check out: http://www.djangoproject.com/documentation/admin/ On Aug 29, 10:44 pm, "Ramin Miraftabi" <[EMAIL PROTECTED]> wrote: > Hi. > > I'm stumped and can't figure out a solution for the following: > > With the models: > > class Entry(models.Model): > pub_date = models.DateTimeField('date published') > created = models.DateTimeField(auto_now_add=True, editable=False) > edited = models.DateTimeField(auto_now=True, editable=False) > title = models.CharField(max_length=200, blank=True) > title_fi = models.CharField(max_length=200, blank=True) > is_memorial = models.BooleanField('Use special layout?', default=False) > > class Image(models.Model): > entry = models.ForeignKey(Entry, related_name='images') > file = models.ImageField(upload_to="%Y") > caption = models.TextField() > caption_fi = models.TextField() > > And forms: > > class ImageForm(forms.ModelForm): > file = forms.ImageField() > caption = forms.CharField(label='Default caption', > widget=forms.Textarea) > caption_fi = forms.CharField(label='Caption in Finnish', required=False, > widget=forms.Textarea) > > class ImageInline(admin.TabularInline): > model = Image > extra = 1 > form = ImageForm > > class EntryForm(forms.ModelForm): > pub_date = forms.DateField(label='Publication date', > initial=datetime.date.today() + datetime.timedelta(1)) > title = forms.CharField(max_length=200, required=False) > title_fi = forms.CharField(label='Finnish title', max_length=200, > required=False) > is_memorial = forms.BooleanField(label='Use special layout?', > initial=False, required=False) > tags = forms.CharField(max_length=200,required=False) > > class EntryAdmin(admin.ModelAdmin): > date_hierachy = 'pub_date' > list_display = ('pub_date', 'title') > list_filter = ('pub_date',) > ordering = ('-pub_date',) > search_fields = ('pub_date', 'title') > inlines = [ > ImageInline, > ] > form = EntryForm > > I can easily start creating a new Entry in admin, but trying to open a > previously created entry results in the following error: > > Template error > > In template > /usr/lib/python2.5/site-packages/django/contrib/admin/templates/admin/edit_inline/tabular.html, > error at line *24* > Caught an exception while rendering: coercing to Unicode: need string or > buffer, ImageFieldFile found 14 {% endfor %} 15 {% if > inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% > endif %} 16 </tr></thead> 17 > 18 {% for inline_admin_form in inline_admin_formset %} 19 > 20 <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or > inline_admin_form.show_url %}has_original{% endif %}"> 21 > 22 <td class="original"> 23 {% if inline_admin_form.original or > inline_admin_form.show_url %}<p> 24 {% if inline_admin_form.original %} {{ > inline_admin_form.original }}{% endif %} > In Django Alpha 1 this wasn't a problem (in fact I didn't even need to > define a form for the Image model since in the model I could define old > stuff). > With Django 8730 this error appears. > > Any ideas? > > ramin > -- > Ramin Miraftabihttp://fierymill.net/ramin/ > blog @http://randomfire.fierymill.net/ > > Kolme flättiä ja kultsu:http://fierymill.net/loj/ > Three flatcoats and a golden:http://fierymill.net/loj/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---