class PublishOptionsForm(forms.Form):
days = forms.IntegerField(label=u'po ilu dniach udostępnienić (0 = od razu)', min_value=0, initial=0)
+ hidden = forms.BooleanField(label='tekst ukryty przed wyszukiwaniem', required=False, initial=False)
beta = forms.BooleanField(label=u'Opublikuj na wersji testowej', required=False)
parse_dublincore=parse_dublincore,
strict=strict)
- def publish(self, user, fake=False, host=None, days=0, beta=False):
+ def publish(self, user, fake=False, host=None, days=0, beta=False, hidden=False):
"""
Publishes a book on behalf of a (local) user.
"""
changes = self.get_current_changes(publishable=True)
if not fake:
book_xml = self.materialize(changes=changes)
- data = {"book_xml": book_xml, "days": days}
+ data = {"book_xml": book_xml, "days": days, "hidden": hidden}
if host:
data['gallery_url'] = host + self.gallery_url()
apiclient.api_call(user, "books/", data, beta=beta)
if form.is_valid():
days = form.cleaned_data['days']
beta = form.cleaned_data['beta']
+ hidden = form.cleaned_data['hidden']
else:
days = 0
beta = False
+ hidden = False
book = get_object_or_404(Book, slug=slug)
if not book.accessible(request):
return HttpResponseForbidden("Not authorized.")
try:
protocol = 'https://' if request.is_secure() else 'http://'
- book.publish(request.user, host=protocol + request.get_host(), days=days, beta=beta)
+ book.publish(request.user, host=protocol + request.get_host(), days=days, beta=beta, hidden=hidden)
except NotAuthorizedError:
return http.HttpResponseRedirect(reverse('apiclient_oauth' if not beta else 'apiclient_beta_oauth'))
except BaseException as e: