Oops i posted too fast....is there a better way to accomplish the
above?

On Jul 10, 12:41 pm, "het.oosten" <het.oos...@gmail.com> wrote:
> I got is working like this:
>
> In my model:
>         titel = models.CharField(max_length=200)
>         alt = models.CharField(max_length=200)
>         plaatje = models.ImageField(upload_to='plaatjes/')
>         menu = models.ForeignKey(Menu)
>         seizoenen = models.ManyToManyField(Seizoenen)
>         def __unicode__(self):
>                 return '<img src=\"/%s\" alt=\"%s\">' % (self.plaatje,
> self.alt)
>
> In my view:
> content_tekst = Tekst.objects.filter(menu__slug__iexact=seizoen)[:1]
>         content_images =
> Images.objects.filter(menu__slug__iexact=seizoen)
>         from django.template import Context, Template
>         for x in content_text:
>                 t = Template(x.text)
>                 c = Context({"image": content_images})
>                 y = t.render(c)
>
> In the text i store in the database (content_text):
> text
> {{ image.0| safe}}
> more text
> {{ image.1|safe}}
>
> Finally I render y in an existing template with a RequestContext

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

Reply via email to