Try this: def photo_ad(self): if self.photo: return True return False photo_ad.boolean = True
--- Александр Кошелев daeva...@gmail.com On Tue, Jan 27, 2009 at 8:51 AM, Paddy Joy <paddy...@gmail.com> wrote: > > The admin interface shows nice green/red icons for BooleanFields. If I > have a callable that returns only true or false, is there a way I can > make these show in the admin with icons rather than the text > 'True'/'False' > > For example I would like the callable 'photo_ad' to show on the list > display with icons rather than text. > > Paddy > > models.py > > class Ad(models.Model): > photo = models.ImageField(upload_to="images",blank=True) > expired = models.BooleanField() > > def photo_ad(self): > if self.photo: > return True > return False > > admin.py > class AdAdmin(admin.ModelAdmin): > list_display = ('category', 'aw', 'firstword', > 'description','suburb', 'photo_ad', 'phone', 'expired') > search_fields = ('firstword', 'description') > pass > admin.site.register(Ad, AdAdmin) > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---