Hi,

I would like to store some image files related to one object.
For example: object "City" can have several pictures
Now I do so:

class ImageCatalog(models.Model):
    name = models.CharField(maxlength=255)

class Image(models.Model):
    source = models.ImageField(upload_to="...")
    catalog = models.ForeignKey(ImageCatalog,
edit_inline=models.TABULAR)

class City(modesl.Model):
    ...
    name = models.CharField(maxlength=255)
    images = models.ForeignKey(ImageCatalog)
    def save(self):
        if (self.id is None):
            ic = ImageCatalog(name='[city]%s'%self.name)
            ic.save()
            self.images = ic
        models.Model.save(self)

but a problem in, whether that to add a new file to "City" object I
have to use "ImageCatalog" object.
Is there any other solution, how to manage Images in the same "City"
object form ?


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