As I continue to test this, it appears that inline image fields don't
work at all in newforms Admin. Yikes!!! Can someone confirm?

My code:

from django.db import models

class TestObject(models.Model):
    somefield = models.CharField(max_length=100)

class TestObjectImageInline(models.Model):
    test_object = models.ForeignKey(TestObject)
    image = models.ImageField(upload_to='images')
    anotherfield = models.BooleanField(default=True)

from django.contrib import admin

class TestObjectInline(admin.TabularInline):
    model = TestObjectImageInline

class TestObjectAdmin(admin.ModelAdmin):
    model = TestObject
    inlines = [TestObjectInline]

admin.site.register(TestObject, TestObjectAdmin)


On Feb 14, 4:34 pm, Michael Newman <[EMAIL PROTECTED]> wrote:
> I get an 'Upload a valid image. The file you uploaded was either not
> an image or a corrupted image.' When I try to save a model in the
> admin. I had this issue in the oldforms admin as well. I was passed to
> this 
> article:http://scottbarnham.com/blog/2007/08/22/edit-inline-with-imagefield-o...
> . The ticket was thrown out because of the anticipation of newforms
> admin. Odd thing is FileField does not throw the same error.
>
> Here is my code:
>
> from django.db import models
>
> class TestObject(models.Model):
>     somefield = models.CharField(max_length=100)
>
> class TestObjectImageInline(models.Model):
>     test_object = models.ForeignKey(TestObject)
>     image = models.ImageField(upload_to='images')
>
> from django.contrib import admin
>
> class TestObjectInline(admin.TabularInline):
>     model = TestObjectImageInline
>
> class TestObjectAdmin(admin.ModelAdmin):
>     model = TestObject
>     inlines = [TestObjectInline]
>
> admin.site.register(TestObject, TestObjectAdmin)
>
> Can others duplicate? I am planning on filing a ticket but I would
> like to figure out where it is that the error is being thrown. Any
> insight on that would be great as well.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to