Hello, I am quite new to django, and trying to solve an issue I am having with ImageField in admin. I have an attachable model to upload images, which can be then in turn attached to different models through generic relations:
# in the models.py class Attachment(models.Model): filename = models.ImageField(upload_to = "attachments") object_id = models.PositiveIntegerField() content_type = models.ForeignKey(ContentType) content_object = generic.GenericForeignKey("content_type", "object_id") class Meta: db_table = u'attachments' def __unicode__(self): return self.filename.name It works just fine - images are uploaded, objects are saved in db correctly etc. However, when I use this model in admin (either in its own edit page or in an inline of a related model) for uploaded images admin creates a link which is like: Currently: /path/to/image When I click on it, I get an ValueError. I don't know actually what normally it is expected to return, but since it opens in a new tab, I assume it would bring up the image uploaded. Can someone help? Any ideas appreciated. Thanks --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---