Ejemplo n.º 1
0
    def form_valid(self, form):
        self.object = form.save(commit=False)
        self.object.owner = self.request.user

        ret =  super(CronCreateView, self).form_valid(form)

        sr = SystemRequest(self.user, self.user.parms.web_machine)
        sr.cron(self.user)
        messages.add_message(self.request, messages.SUCCESS, _('Cron record has been created'))

        return ret
Ejemplo n.º 2
0
def remove_cron(request):
    u = request.session.get('switched_user', request.user)
    superuser = request.user
    try:
        cron = request.user.cron_set.get(id=int(request.POST.get("object_id")))
        cron.delete()
        sr = SystemRequest(request.user, request.user.parms.web_machine)
        sr.cron(request.user)
        return JsonResponse("OK", {1: ugettext("Cron record was successfuly removed")})
    except Exception, e:
        return JsonResponse("KO", {1: ugettext("Error deleting cron record")})
Ejemplo n.º 3
0
 def form_valid(self, form):
     ret = super(CronUpdateView, self).form_valid(form)
     sr = SystemRequest(self.user, self.user.parms.web_machine)
     sr.cron(self.user)
     messages.add_message(self.request, messages.SUCCESS, _('Cron record has been updated'))
     return ret