-
-
-@require_POST
-@ajax_require_permission('catalogue.can_pubmark')
-def pubmark(request, chunk_id):
- form = forms.DocumentPubmarkForm(request.POST, prefix="pubmark")
- if form.is_valid():
- doc = get_object_or_404(Chunk, pk=chunk_id)
- if not doc.book.accessible(request):
- return HttpResponseForbidden("Not authorized.")
-
- revision = form.cleaned_data['revision']
- publishable = form.cleaned_data['publishable']
- change = doc.at_revision(revision)
- if publishable != change.publishable:
- change.set_publishable(publishable)
- return JSONResponse({"message": _("Revision marked")})
- else:
- return JSONResponse({"message": _("Nothing changed")})
- else:
- return JSONFormInvalid(form)
-
-
-def themes(request):
- prefix = request.GET.get('q', '')
- return http.HttpResponse('\n'.join([str(t) for t in Theme.objects.filter(name__istartswith=prefix)]))