On Aug 29, 2008, at 2:22 PM, Benjamin Buch wrote:

>
> Clumsy subject, I know...
>
> I know there was a recent discussion about this, but I lost it, so
> sorry for asking again.
> So here's the question:
>
> How can you allow your users to add something like pictures into
> something like blog posts?
> Not just below or above (this could be achieved by a simple foreignkey
> I guess...), but at positions they want to?
>
> Antoher related question would be if it's possible to include tags and
> variables ({{ somevariable }}) into text I enter into the admin?
>
> -benjamin
>  


Yes, and yes, and the solution is both cases is the same.

As to how to get the image up there and reference it, here's a  
suggestion: Create a model just for images, a form for users to upload  
images, and a custom tag which I can then use to insert an image by  
name. They can then use the tag in the blog post to include the image.

To allow tags to be used in content areas, including what you add in  
the admin, you will need to double-render your page.

Like this:

my_context = {'blah': 'blah'}
output = render_to_string('my_template.html', my_context)
t = Template(output)
HttpResponse(t.render())



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