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"))
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
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"))
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
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())
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}))
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())
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}))
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)
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)
def handle(self, *args, **options): for domain in Domain.objects.all(): script = DomainObject() script.update(domain) script.commit() script.reload()