On Thu, 2008-04-17 at 07:00 -0700, Legioneer wrote:
> Hi All!
> 
> Trying to get a solution for a problem. I have a model which has one
> to many relationship with another model which contains an ImageField.
> E.g:
> 
> class Person(models.Model):
>     name = models.CharField(max_length=512)
> 
> class Image(models.Model):
>     image = models.ImageField(upload_to='/images')
>     active = models.BooleanField(default=True)
>     person = models.ForeignKey(Person)
> 
> 
> How is it possible to display pictures of a person (with checkbox
> corresponding to 'active' field) in a person change page instead of
> filenames when using django admin? Is there some 'render' method in a
> model or smth like this? Any clue will be appreciated.

Read the documentation for the list_display option in the Admin inner
class. You can use methods on the model to create output for the change
list page, so a method on the Person model could return the HTML
required to display the image (read about the allow_tags attribute on
methods in the same section of the documentation). Another method could
return the "active" link. 

Regards,
Malcolm

-- 
Plan to be spontaneous - tomorrow. 
http://www.pointy-stick.com/blog/


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