Similar issues have been raised in [1] and [2], but unfortunately I
could not find an answer for this.
Basically I have a custom template whose 'render' method never gets
called (the 'init', however, does):
class ShowParticipantNode(Node):
def __init__(self, participant, edit):
self.participant = participant
self.edit = edit
def render(self, context):
self.participant = self.participant.resolve(context)
request = resolve_variable('request', context)
context = {'me': request.user, 'participant':
self.participant }
if self.edit == 'edit':
return render_to_string('projects/units/
participant_edit.html', context)
else:
return render_to_string('projects/units/participant.html',
context)
def show_participant(parser, token):
bits = token.contents.split(' ', 2)
if len(bits) > 3 :
raise TemplateSyntaxError("'%s' takes at most 2 argument" %
bits[0])
if len(bits) == 3:
return ShowParticipantNode(parser.compile_filter(bits[1]),
bits[2])
else:
return ShowParticipantNode(parser.compile_filter(bits[1]),
'display')
show_participant = register.tag(show_participant)
Remark: I could not use a simple_tag for this as simple_tag doesn't
accept context as argument like inclusion_tag does.
The template is very simple, only a few lines:
{% load project_tags %}
{% for participant in participants %}
{% show_participant participant %}
{% endfor %}
The threads [1] and [2] mention inheritance, but I don't know if that
apply to my case. Do you know what I could do to troubleshoot this?
Thanks a lot!
Julien
[1]
http://groups.google.com/group/django-users/browse_thread/thread/4501aa624159b17d/1c363af87856a551
[2]
http://groups.google.com/group/django-users/browse_thread/thread/764df4d9a5b1dcc5/419fe0d904609e19
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---