Ok perhaps a basic question. I wrote a custom method for my model: def image_list(self): return '<img src=\"/media/%s\" alt=\"%s\">' % (self.image, self.alt) And i indeed get a nice list of image in the template. I want however control where the single images show up. With something like {{image. 1}} other text {{image.2}} in the text.
How do i accomplist this? On Jul 10, 5:54 pm, Shawn Milochik <sh...@milochik.com> wrote: > I'd rather see the contents of your __unicode__ function as a > get_absolute_url function, with the __unicode__ maybe returning just the > filename or the parent object's title and the filename. > > I strongly dislike the embedding of template code in a text field of > your model, because it makes maintenance a lot harder. I don't know what > your code looks like that reads and writes that, so maybe it works for > you. In any case, have a look at adding a method or property to your > model that returns an iterable of image links. I think it'll be a lot > easier to maintain in the long run. -- 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.