X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/47fb67f3c824094213cd33ebebf8e70ec149b783..21c8ba33691b168fbc69ab7f663d1b6fb99808d9:/apps/catalogue/forms.py?ds=inline diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index f59b356c..a2ae86ad 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -20,7 +20,7 @@ class DocumentCreateForm(forms.ModelForm): class Meta: model = Book - exclude = ['parent', 'parent_number'] + exclude = ['parent', 'parent_number', 'project'] def __init__(self, *args, **kwargs): super(DocumentCreateForm, self).__init__(*args, **kwargs) @@ -72,7 +72,7 @@ class ChunkForm(forms.ModelForm): """ user = forms.ModelChoiceField(queryset= User.objects.annotate(count=Count('chunk')). - order_by('-count', 'last_name', 'first_name'), required=False, + order_by('last_name', 'first_name'), required=False, label=_('Assigned to')) class Meta: @@ -130,6 +130,7 @@ class BookForm(forms.ModelForm): class Meta: model = Book + exclude = ['project'] def __init__(self, *args, **kwargs): ret = super(BookForm, self).__init__(*args, **kwargs) @@ -144,7 +145,7 @@ class ReadonlyBookForm(BookForm): def __init__(self, *args, **kwargs): ret = super(ReadonlyBookForm, self).__init__(*args, **kwargs) for field in self.fields.values(): - field.widget.attrs.update({"readonly": True}) + field.widget.attrs.update({"disabled": "disabled"}) return ret @@ -174,10 +175,10 @@ class ImageForm(forms.ModelForm): class ReadonlyImageForm(ImageForm): - """Form used for not editing a Book.""" + """Form used for not editing an Image.""" def __init__(self, *args, **kwargs): ret = super(ReadonlyImageForm, self).__init__(*args, **kwargs) for field in self.fields.values(): - field.widget.attrs.update({"readonly": True}) + field.widget.attrs.update({"disabled": "disabled"}) return ret