Hi all

I'm new to Django, and I'm seeing various complaints about the
ImageField, specifically it's basic inability to work as advertised. I
think I've tried every permutation of trying to make it accomplish the
simple task of working as part of an "image gallery" and "image" model,
although in my case, I need an "article" and "article image" model
where one article can have more than one image.

The basic strategy seems to be:

Make the "article" class unaware of the "article image" class, and

Make the "article image" class lack the "admin" meta attribute, setting
a ForeignKey, and edit_inline=meta.TABULAR or some such. My model
exaple is below in case this didn't make any sense to whoever is
reading this.

I'd like to know if anyone has solved this type of use-case with a
different approach.

This model example blows up horribly, and complains in an extremely
cryptic manner, but despite this, successfully creates an image file on
disk, and a correct looking set of data in the db (postgres). In other
model permutations,when I was able to complete uploads successfully, I
encountered other problems, reported by others previously on this list:
such as ghost records in the db to represent empty upload forms, and
previously uploaded images have their db records "mashed" (the file
path field becomes an empty string) by the process of submitting a form
for a second time.

My current, cryptic error (using only default templates):

  TemplateSyntaxError: Caught an exception while rendering.

Model stuff:

class Article(meta.Model):

    article_title = meta.CharField(maxlength=512)

    def __repr__(self):
        self.article_title

    class META:

        admin = meta.Admin(

            list_display = ('vol_issue', 'category', 'author',
'article_title'),
            list_filter = ['vol_issue'],

            )


class ArticleImage(meta.Model):

    article = meta.ForeignKey(Article, edit_inline=meta.TABULAR,
num_in_admin=1)

    image_caption = meta.CharField(maxlength=256, blank=True)
    the_image =
meta.ImageField(upload_to='/home/sparky/django_instances/gbtt/media/editorial_u\
ploads/', core=True)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to