A short cut
register = template.Library()
class SponsorsListNode(template.Node):
def __init__(self, section, varname):
self.section = section
self.varname = varname
def __repr__(self):
return "<Sponsor Node>"
def render(self, context):
context[self.varname] =
Section.objects.all().order_by('?').filter(section=self.section)
return ''
could be
def build_sponsor_list(parser, token):
""" {% get_sponsor_list %}"""
return SponsorListObject()
class SponsorListObject(template.Node):
def render(self, context):
context['sponsor_list'] =
Section.objects.all().order_by('?').filter(section=self.section)
return ''"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---