Ejemplo n.º 1
0
 def get_context_data(self, **kwargs):
     context = super(DashboardView, self).get_context_data(**kwargs)
     widgets = []
     for widget in Widget.get_all(self.request):
         if widget.is_active():
             widgets.append(widget)
             context['extra_stylefiles'].extend(widget.get_stylesheets())
             context['extra_javascript'].extend(widget.get_javascript_files())
     context['widgets'] = widgets
     return context
Ejemplo n.º 2
0
 def get_widget(self, name):
     request = self.request_factory.get('/')
     request.user = AnonymousUser()
     for widget in Widget.get_all(request):
         if widget.name == name:
             value = widget
             break
     else:
         value = False
     return value
Ejemplo n.º 3
0
    def get_context_data(self, **kwargs):
        context = super(SelectWidgetsView, self).get_context_data(**kwargs)

        widgets = Widget.get_all(self.request)
        for widget in widgets:
            initial = {'widget': widget.is_active()}
            prefix = widget.name
            if self.request.method == 'POST':
                widget.form = SelectWidgetsForm(self.request.POST, prefix=prefix,
                                                initial=initial)
            else:
                widget.form = SelectWidgetsForm(prefix=prefix, initial=initial)
        context['widgets'] = widgets
        return context
Ejemplo n.º 4
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     widgets = Widget.get_all(self.request)
     for widget in widgets:
         initial = {'widget': widget.is_active()}
         prefix = widget.name
         if self.request.method == 'POST':
             widget.form = SelectWidgetsForm(self.request.POST,
                                             prefix=prefix,
                                             initial=initial)
         else:
             widget.form = SelectWidgetsForm(prefix=prefix, initial=initial)
     context['widgets'] = widgets
     return context