Skip to content

Commit

Permalink
agregado soporte a RequestContext en las templates
Browse files Browse the repository at this point in the history
  • Loading branch information
igorgue committed Jan 30, 2009
1 parent bb3ca6a commit 336d4df
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion softwarelibre/apps/answers/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, get_list_or_404, render_to_response
from django.template import RequestContext

from models import Question, Answer, Votes
from forms import QuestionForm, AnswerForm

Expand Down Expand Up @@ -42,7 +44,7 @@ def view_question(request, question_id):
form = None

dict = {'question': question, 'answers': answers, 'form': form}
return render_to_response('answers/view_question.html', dict)
return render_to_response('answers/view_question.html', RequestContext(request, dict))

def ask_question(request):
if request.user.is_authenticated():
Expand Down
7 changes: 7 additions & 0 deletions softwarelibre/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
# 'django.template.loaders.eggs.load_template_source',
)

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media"
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down
10 changes: 10 additions & 0 deletions softwarelibre/templates/answers/view_question.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
{%for answer in answers.object_list%}
{{answer.author.username|title}} respondió:<br/>
{{answer.text|striptags|urlize}} <br/> <br/>
<p>username = {{ user.id }}</p>
{% if user.is_authenticated %}
<p>users: {{ user.id }} {{ question.author.id }}</p>
{% ifequal user.id question.author.id %}
<form action="/soporte/correcta" method="POST">
<input type="hidden" value"{{ question.pk }}" />
<p><input type="submit" value="Correcta! &rarr;" /></p>
</form>
{% endifequal %}
{% endif %}
{%endfor%}
{%if form%}
<form action="/soporte/pregunta/{{question.id}}/responder" method = "POST">
Expand Down

0 comments on commit 336d4df

Please sign in to comment.