On Fri, 2010-08-20 at 14:00 -0700, Kevin wrote:
> I come from the world of mod_python and really enjoyed the PSP
> template system, where I can embed Python code directly in my template
> for dynamically generating menus and such.
> 
> What is the recommended method of calling a PSP template from inside
> Django and rendering it?
> 
> Here is a sniplet of code I am trying to convert over to the Django
> template engine, but cannot figure out the best method:
> 
> for name, text, url in menu_items:
>     attr = ""
>     if name == hlight:
>         attr = "class='highlight'"
>     # begin
> %>
>             <tr><td <%=attr%>><a href="<%=url%>"><%=text%></a></td></
> tr>
> <%
> # end
> %>
> 
> And yes, this menu code is from the mod_python example site.  Also
> does Django include an example fully working site to display most, if
> not all of it's abilities?  The example site which mod_python includes
> is very simple, but is a great starting point for a website.
> 
> mod_python's example site is here:  http://modpython.org/examples/
> 
> I really think having such an example for django would be good as
> well.  I am actually in the process of basically re-creating this
> example site in django to learn how django works and how it differs
> from mod_python coding.
> 

Django has it's own templating system.  You can use others, but if
you're just starting off it's probably best to stick with what's
built-in.  Like most toolkits, there is no 1-to-1 translation between
PSP and Django.  They are indeed very different beasts. You are best off
just learning how things work in Django and adapting to its methods and
idiosyncrasies.  

Have you actually visited the Django web site[1]?  There are tutorials
and API docs and other examples.  A once-through at the tutorial should
give you a good idea how Django's templates and PSP differ. That should
help you get started such that at least you can ask more concrete
questions.

[1] http://www.djangoproject.com/


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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