def clean(self): self.cleaned_data['cust'] = self.customizations self.cleaned_data['path'] = get_customized_pdf_path(self.book, self.cleaned_data['cust']) if not WaitedFile.can_order(self.cleaned_data['path']): raise ValidationError(_('Queue is full. Please try again later.')) return self.cleaned_data
def clean(self): self.cleaned_data['cust'] = self.customizations self.cleaned_data['path'] = get_customized_pdf_path( self.book, self.cleaned_data['cust']) if not WaitedFile.can_order(self.cleaned_data['path']): raise ValidationError(_('Queue is full. Please try again later.')) return self.cleaned_data
def save(self, *args, **kwargs): if not self.cleaned_data["cust"] and self.book.pdf_file: # Don't build with default options, just redirect to the standard file. return {"redirect": self.book.pdf_file.url} url = WaitedFile.order( self.cleaned_data["path"], lambda p, waiter_id: build_custom_pdf.delay(self.book.id, self.cleaned_data["cust"], p, waiter_id), self.book.pretty_title(), ) return {"redirect": url}
def save(self, *args, **kwargs): if not self.cleaned_data['cust'] and self.book.pdf_file: # Don't build with default options, just redirect to the standard file. return {"redirect": self.book.pdf_file.url} url = WaitedFile.order( self.cleaned_data['path'], lambda p, waiter_id: build_custom_pdf.delay(self.book.id, self.cleaned_data['cust'], p, waiter_id), self.book.pretty_title() ) return {"redirect": url}
def wait(request, path): if WaitedFile.exists(path): file_url = join(WAITER_URL, path) else: file_url = "" waiting = get_object_or_404(WaitedFile, path=path) if request.is_ajax(): return HttpResponse(file_url) else: return render(request, "waiter/wait.html", locals())
def save(self, *args, **kwargs): if not self.cleaned_data['cust'] and self.book.pdf_file: # Don't build with default options, just redirect to the standard file. return {"redirect": self.book.pdf_file.url} url = WaitedFile.order(self.cleaned_data['path'], lambda p: build_custom_pdf.delay(self.book.id, self.cleaned_data['cust'], p), self.book.pretty_title() ) #return redirect(url) return {"redirect": url}
def wait(request, path): if WaitedFile.exists(path): file_url = join(WAITER_URL, path) else: file_url = "" waiting = get_object_or_404(WaitedFile, path=path) if waiting.is_stale(): waiting = None if request.is_ajax(): return HttpResponse(file_url) else: return render(request, "waiter/wait.html", locals())
def wait(request, path): if WaitedFile.exists(path): file_url = join(WAITER_URL, path) waiting = None else: file_url = None waiting = get_object_or_404(WaitedFile, path=path) if request.is_ajax(): return HttpResponse(file_url) else: return render(request, "waiter/wait.html", { 'waiting': waiting, 'file_url': file_url, })