コード例 #1
0
ファイル: views.py プロジェクト: narcisaam/wouso
    def dispatch(self, request, *args, **kwargs):
        if not request.user.is_superuser:
            return redirect('status')

        self.customization = Customization()

        return super(CustomizationView, self).dispatch(request, *args, **kwargs)
コード例 #2
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)
コード例 #3
0
ファイル: views.py プロジェクト: Ionut1994/wouso
    def dispatch(self, request, *args, **kwargs):
        if not request.user.is_superuser:
            return redirect('status')

        self.customization = Customization()

        return super(CustomizationView, self).dispatch(request, *args, **kwargs)
コード例 #4
0
ファイル: views.py プロジェクト: anaion/wouso
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))
コード例 #5
0
ファイル: views.py プロジェクト: TobyWanKenobi/wouso
class CustomizationView(TemplateView):
    template_name = 'cpanel/customization.html'

    def dispatch(self, request, *args, **kwargs):
        if not request.user.is_superuser:
            return redirect('status')
        self.customization = Customization()
        return super(CustomizationView, self).dispatch(request, *args, **kwargs)

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

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

        return context