X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5913c54d19b8f6775633176032161d49f9b2f1aa..1c013c31745b335962a07057f962e47212faf80f:/src/wiki/forms.py diff --git a/src/wiki/forms.py b/src/wiki/forms.py index 3ef3ed14..f7827bc1 100644 --- a/src/wiki/forms.py +++ b/src/wiki/forms.py @@ -1,22 +1,20 @@ -# -*- coding: utf-8 -*- -# # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ -from catalogue.models import Chunk +from documents.models import Chunk class DocumentPubmarkForm(forms.Form): """ - Form for marking revisions for publishing. + Form for approving revisions. """ id = forms.CharField(widget=forms.HiddenInput) publishable = forms.BooleanField(required=False, initial=True, - label=_('Publishable')) + label=_('Approved')) revision = forms.IntegerField(widget=forms.HiddenInput) @@ -60,16 +58,24 @@ class DocumentTextSaveForm(forms.Form): ) publishable = forms.BooleanField(required=False, initial=False, - label=_('Publishable'), - help_text=_(u"Mark this revision as publishable.") + label=_('Approve'), + help_text=_("Approve this revision.") ) def __init__(self, *args, **kwargs): user = kwargs.pop('user') r = super(DocumentTextSaveForm, self).__init__(*args, **kwargs) - if user and user.is_authenticated(): + if user and user.is_authenticated: self.fields['author_name'].required = False self.fields['author_email'].required = False + try: + user.profile + except: + pass + else: + if user.profile.approve_by_default: + self.fields['publishable'].initial = True + return r