I think I got your concept, converting all MEDIA_URL to corresponding
url before displaying.
But I still curious to know where should I put this code in the
project?

I've been thinking and can only come up with a way, by creating a new
middleware replicating FlatpageFallbackMiddleware
but instead of calling a view in django.contrib, it will call my new
view that has been modified by your suggestion.

However, I don't like this method. It forces me to copy an entire
django's view, which i think it's not a future-proof.

Your suggestion?


On Jun 25, 4:41 pm, Rama Vadakattu <rama.vadaka...@gmail.com> wrote:
> Please ignore the last line..........
>
> On Jun 25, 2:40 pm, Rama Vadakattu <rama.vadaka...@gmail.com> wrote:
>
> > you can put {{MEDIA_URL}}
>
> > but while displaying instead of displaying it directly  just do the
> > below
>
> > from django.template.loader import render_to_string
> > from django.template import Context, Template
>
> > t = Template("flat page content goes here")
> > newflatpage = t.render({},context_instance=RequestContext(request))
> > #above is the new flat page where media url are replaced by their
> > corresponding urls
>
> > subject = render_to_string('',{},RequestContext(request))
>
> > On Jun 25, 12:53 pm, Panu Tangchalermkul <pan...@gmail.com> wrote:
>
> > > In the content of my flatpage, there's a picture to be displayed that
> > > it was stored in django media folder. I want to link to this file
> > > without having to specify its url directly. Instead, I want to use
> > > something like {{MEDIA_URL}} when editing the content via django-
> > > admin. I know I can use it normally on flatpage template but how about
> > > on the content?
--~--~---------~--~----~------------~-------~--~----~
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