@register.inclusion_tag(u'includes/search_form.html', takes_context=True)
def search_form(context, search_model_names=None):
 template_vars = {u'request': context[u'request']}
 if ((not search_model_names) or (not settings.SEARCH_MODEL_CHOICES)):
  search_model_names = []
 elif (search_model_names == u'all'):
  search_model_names = list(settings.SEARCH_MODEL_CHOICES)
 else:
  search_model_names = search_model_names.split(u' ')
 search_model_choices = []
 for model_name in search_model_names:
  try:
   model = apps.get_model(*model_name.split(u'.', 1))
  except LookupError:
   pass
  else:
   verbose_name = model._meta.verbose_name_plural.capitalize()
   search_model_choices.append((verbose_name, model_name))
 template_vars[u'search_model_choices'] = sorted(search_model_choices)
 return template_vars

@ register . inclusion_tag ( u'includes/search_form.html' , takes_context = True ) def search_form ( context , search_model_names = None ) : template_vars = { u'request' : context [ u'request' ] } if ( ( not search_model_names ) or ( not settings . SEARCH_MODEL_CHOICES ) ) : search_model_names = [ ] elif ( search_model_names == u'all' ) : search_model_names = list ( settings . SEARCH_MODEL_CHOICES ) else : search_model_names = search_model_names . split ( u' ' ) search_model_choices = [ ] for model_name in search_model_names : try : model = apps . get_model ( * model_name . split ( u'.' , 1 ) ) except LookupError : pass else : verbose_name = model . _meta . verbose_name_plural . capitalize ( ) search_model_choices . append ( ( verbose_name , model_name ) ) template_vars [ u'search_model_choices' ] = sorted ( search_model_choices ) return template_vars
displays a search form for searching the list .