示例#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()