Exemple #1
0
 def dispatch(self, request, *args, **kwargs):
     if not request.user.is_superuser:
         return redirect('dashboard')
     self.customization = Customization()
     self.switchboard = Switchboard()
     return super(CustomizationView, self).dispatch(request, *args,
                                                    **kwargs)
Exemple #2
0
def customization(request):
    if not request.user.is_superuser:
        return HttpResponseRedirect(reverse('dashboard'))

    customization = Customization()
    switchboard = Switchboard()

    if request.method == "POST":
        for group in (customization, switchboard):
            for s in group.props():
                val = request.POST.get(s.name, '')
                s.set_value(val)

    return render_to_response('cpanel/customization.html',
                              {'settings': (customization, switchboard),
                               'module': 'custom'},
                              context_instance=RequestContext(request))
Exemple #3
0
class FeaturesView(TemplateView):
    template_name = 'cpanel/features.html'

    def dispatch(self, request, *args, **kwargs):
        self.switchboard = Switchboard()
        return super(FeaturesView, self).dispatch(request, *args, **kwargs)

    def post(self, request, *args, **kwargs):
        for s in self.switchboard.props():
            val = request.POST.get(s.name, '')
            s.set_value(val)

        return redirect('features')

    def get_context_data(self, **kwargs):
        context = super(FeaturesView, self).get_context_data(**kwargs)
        context.update(dict(settings=self.switchboard))

        return context
Exemple #4
0
 def dispatch(self, request, *args, **kwargs):
     self.switchboard = Switchboard()
     return super(FeaturesView, self).dispatch(request, *args, **kwargs)
Exemple #5
0
 def __init__(self, **kwargs):
     super(FeaturesView, self).__init__(**kwargs)
     self.switchboard = Switchboard()
Exemple #6
0
 def __init__(self, **kwargs):
     super(FeaturesView, self).__init__(**kwargs)
     self.switchboard = Switchboard()