@register.tag
def get_flatpages(parser, token):
 bits = token.split_contents()
 syntax_message = ("%(tag_name)s expects a syntax of %(tag_name)s ['url_starts_with'] [for user] as context_name" % dict(tag_name=bits[0]))
 if ((len(bits) >= 3) and (len(bits) <= 6)):
  if ((len(bits) % 2) == 0):
   prefix = bits[1]
  else:
   prefix = None
  if (bits[(-2)] != 'as'):
   raise template.TemplateSyntaxError(syntax_message)
  context_name = bits[(-1)]
  if (len(bits) >= 5):
   if (bits[(-4)] != 'for'):
    raise template.TemplateSyntaxError(syntax_message)
   user = bits[(-3)]
  else:
   user = None
  return FlatpageNode(context_name, starts_with=prefix, user=user)
 else:
  raise template.TemplateSyntaxError(syntax_message)

@ register . tag def get_flatpages ( parser , token ) : bits = token . split_contents ( ) syntax_message = ( "%(tag_name)s expects a syntax of %(tag_name)s ['url_starts_with'] [for user] as context_name" % dict ( tag_name = bits [ 0 ] ) ) if ( ( len ( bits ) >= 3 ) and ( len ( bits ) <= 6 ) ) : if ( ( len ( bits ) % 2 ) == 0 ) : prefix = bits [ 1 ] else : prefix = None if ( bits [ ( - 2 ) ] != 'as' ) : raise template . TemplateSyntaxError ( syntax_message ) context_name = bits [ ( - 1 ) ] if ( len ( bits ) >= 5 ) : if ( bits [ ( - 4 ) ] != 'for' ) : raise template . TemplateSyntaxError ( syntax_message ) user = bits [ ( - 3 ) ] else : user = None return FlatpageNode ( context_name , starts_with = prefix , user = user ) else : raise template . TemplateSyntaxError ( syntax_message )
retrieves all flatpage objects available for the current site and visible to the specific user .