コード例 #1
0
    def post(self, request, *args, **kwargs):
        ils_config = ILSGatewayConfig.for_domain(self.domain)
        ils_config_form = ILSConfigForm(request.POST)
        if not ils_config_form.is_valid():
            return self.get(request, *args, **kwargs)

        enabled = ils_config_form.cleaned_data['enabled']
        if not ils_config and enabled:
            ils_config = ILSGatewayConfig(enabled=True, domain=self.domain)
            ils_config.save()
        elif ils_config and ils_config.enabled != enabled:
            ils_config.enabled = enabled
            ils_config.save()
        return self.get(request, *args, **kwargs)
コード例 #2
0
    def post(self, request, *args, **kwargs):
        ils_config = ILSGatewayConfig.for_domain(self.domain)
        ils_config_form = ILSConfigForm(request.POST)
        if not ils_config_form.is_valid():
            return self.get(request, *args, **kwargs)

        enabled = ils_config_form.cleaned_data['enabled']
        if not ils_config and enabled:
            ils_config = ILSGatewayConfig(enabled=True, domain=self.domain)
            ils_config.save()
        elif ils_config and ils_config.enabled != enabled:
            ils_config.enabled = enabled
            ils_config.save()
        return self.get(request, *args, **kwargs)
コード例 #3
0
 def page_context(self):
     context = super(ILSConfigView, self).page_context
     context['oneoff_tasks'] = OneOffTaskProgress.objects.filter(domain=self.domain)
     ils_config = ILSGatewayConfig.for_domain(self.domain)
     enabled = False
     if ils_config:
         enabled = ils_config.enabled
     context['form'] = ILSConfigForm(initial={'enabled': enabled})
     return context