예제 #1
0
def rm_domain(request):
    user = request.session.get('switched_user', request.user)
    superuser = request.user

    domain_id = int(request.GET.get("domain_pk"))
    domain = user.dns_set.get(id=domain_id)
    domain.delete()

    script = DomainObject()
    script.update()
    script.uninstall(domain)
    script.reload()
    script.commit()

    messages.add_message(request, messages.SUCCESS,
                         _('Domain has been removed'))

    return HttpResponseRedirect(reverse("dns_list"))
예제 #2
0
    def form_valid(self, form):
        response = super(DomainUpdateView, self).form_valid(form)
        script = DomainObject()
        script.update(self.object)
        script.reload()
        script.commit()

        messages.add_message(self.request, messages.SUCCESS,
                             _('Domain has been updated'))

        return response
예제 #3
0
파일: views.py 프로젝트: a740122/pcp
def rm_domain(request):
    user = request.session.get("switched_user", request.user)
    superuser = request.user

    domain_id = int(request.GET.get("domain_pk"))
    domain = user.dns_set.get(id=domain_id)
    domain.delete()

    script = DomainObject()
    script.update()
    script.uninstall(domain)
    script.reload()
    script.commit()

    messages.add_message(request, messages.SUCCESS, _("Domain has been removed"))

    return HttpResponseRedirect(reverse("dns_list"))
예제 #4
0
파일: views.py 프로젝트: a740122/pcp
    def form_valid(self, form):
        response = super(DomainUpdateView, self).form_valid(form)
        script = DomainObject()
        script.update(self.object)
        script.reload()
        script.commit()

        messages.add_message(self.request, messages.SUCCESS, _("Domain has been updated"))

        return response
예제 #5
0
    def form_valid(self, form):
        self.object = form.save(commit=False)
        self.object.user = self.user
        self.object.save()
        set_domain_default_state(self.object)

        script = DomainObject()
        script.update(self.object)
        script.reload()
        script.commit()

        messages.add_message(self.request, messages.SUCCESS,
                             _('Domain has been created'))

        return HttpResponseRedirect(self.get_success_url())
예제 #6
0
def new_configuration(request, domain_pk):
    user = request.session.get('switched_user', request.user)
    superuser = request.user

    domain = user.dns_set.get(id=domain_pk)

    script = DomainObject()
    script.update(domain)
    script.reload()
    script.commit()

    messages.add_message(request, messages.SUCCESS,
                         _('Configuration has been send to the NS servers.'))

    return HttpResponseRedirect(reverse("dns_editor", kwargs={"pk":
                                                              domain.id}))
예제 #7
0
파일: views.py 프로젝트: a740122/pcp
    def form_valid(self, form):
        self.object = form.save(commit=False)
        self.object.user = self.user
        self.object.save()
        set_domain_default_state(self.object)

        script = DomainObject()
        script.update(self.object)
        script.reload()
        script.commit()

        messages.add_message(self.request, messages.SUCCESS, _("Domain has been created"))

        return HttpResponseRedirect(self.get_success_url())
예제 #8
0
파일: views.py 프로젝트: a740122/pcp
def new_configuration(request, domain_pk):
    user = request.session.get("switched_user", request.user)
    superuser = request.user

    domain = user.dns_set.get(id=domain_pk)

    script = DomainObject()
    script.update(domain)
    script.reload()
    script.commit()

    messages.add_message(request, messages.SUCCESS, _("Configuration has been send to the NS servers."))

    return HttpResponseRedirect(reverse("dns_editor", kwargs={"pk": domain.id}))
예제 #9
0
    def post(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        form = context.get("form")
        if form.is_valid():
            record = form.save(commit=False)
            record.user = self.user
            record.domain = self.get_domain()
            record.save()

            script = DomainObject()
            script.update(self.get_domain())
            script.reload()
            script.commit()

            messages.add_message(request, messages.SUCCESS,
                                 _('Domain zone has been updated'))

            return HttpResponseRedirect(
                reverse("dns_editor", kwargs={"pk": self.kwargs.get("pk")}))
        return self.render_to_response(context)
예제 #10
0
파일: views.py 프로젝트: a740122/pcp
    def post(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        form = context.get("form")
        if form.is_valid():
            record = form.save(commit=False)
            record.user = self.user
            record.domain = self.get_domain()
            record.save()

            script = DomainObject()
            script.update(self.get_domain())
            script.reload()
            script.commit()

            messages.add_message(request, messages.SUCCESS, _("Domain zone has been updated"))

            return HttpResponseRedirect(reverse("dns_editor", kwargs={"pk": self.kwargs.get("pk")}))
        return self.render_to_response(context)
예제 #11
0
 def handle(self, *args, **options):
     for domain in Domain.objects.all():
         script = DomainObject()
         script.update(domain)
         script.commit()
     script.reload()