Django template not working - not rendering {{ }} -


i have followed tutorial making blog engine , integrated it. template not working, have no idea why. can problem?

here template:

{% extends "base.html" %}  {% block title %}{% post.title %}{% endblock %}  {% block content %}  <h3>{{ post.title }}</h3> <p>posted on {{ post.published|date:"f j, y" }}<p>  {{ post.description|safe }} <br> {{ post.body|safe }} <br>  {% if previous_post %} <a href="{{ previous_post.get_absolute_url }}" title="{{ previous_post.title }}"> &laquo;&nbsp;previous post:&nbsp;&nbsp;{{ previous_post.title }} </a>{% endif %}  {% if previous_post , next_post %}&nbsp;|&nbsp;{% endif %}  {% if next_post %} <a href="{{ next_post.get_absolute_url }}" title="{{ next_post.get_absolute_url }}"> next post:&nbsp;&nbsp;{{ next_post.title }}&nbsp;&raquo; </a> {% endif %}  {% endblock content %} 

and here views.py:

def detail(request, sl): try:      post = post.objects.filter(slug=sl)[0]      try:           previous_post = post.get_previous_by_published()      except:           previous_post = ""      try:           next_post = post.get_next_by_published()      except:           next_post = "" except:      next_post = ""      previous_post = ""      post = "" return render_to_response('blog/detail.html', {'post':post,                                         'next_post':next_post,                                         'previous_post':previous_post,                                                                },) 

ok found out , solved problem. wanted post here can use it. n00b mistake.

so {{}} weren't rendering because of fact there nothing in "sl" calling upon argument in function. empty because following tutorial , tutorial didn't explain important thing django, , named groups can added arguments in functions, , had no named group called "sl" in urlconf in appropriate place. adding this:

(r'^([0-9]{4}/\d{1,2})/(?p<sl>.*)/$', detail), 

in urlconf problem solved.

thanks guidance.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -