@register.simple_tag(takes_context=True)
def admin_widget(context, widget):
 request = context.get(u'request')
 siteconfig = SiteConfiguration.objects.get(site=Site.objects.get_current())
 widget_states = siteconfig.get(u'widget_settings')
 if widget_states:
  widget.collapsed = (widget_states.get(widget.name, u'0') != u'0')
 else:
  widget.collapsed = False
 return widget.render(request)

@ register . simple_tag ( takes_context = True ) def admin_widget ( context , widget ) : request = context . get ( u'request' ) siteconfig = SiteConfiguration . objects . get ( site = Site . objects . get_current ( ) ) widget_states = siteconfig . get ( u'widget_settings' ) if widget_states : widget . collapsed = ( widget_states . get ( widget . name , u'0' ) != u'0' ) else : widget . collapsed = False return widget . render ( request )
render a widget with the given information .