-class DocumentForm(forms.ModelForm):
- """
- Form used for editing a chunk.
- """
- user = forms.ModelChoiceField(
- queryset=User.objects.order_by('last_name', 'first_name'),
- required=False, label=_('Assigned to'))
-
- class Meta:
- model = Document
- fields = ['user', 'stage']
-
-
-class BookForm(forms.ModelForm):
- """Form used for editing a Book."""
-
- class Meta:
- model = Document
- exclude = ['project']
-
- def __init__(self, *args, **kwargs):
- super(BookForm, self).__init__(*args, **kwargs)
- self.fields['slug'].widget.attrs.update({"class": "autoslug"})
- self.fields['title'].widget.attrs.update({"class": "autoslug-source"})
-
-
-class ReadonlyBookForm(BookForm):
- """Form used for not editing a Book."""
-
- def __init__(self, *args, **kwargs):
- super(ReadonlyBookForm, self).__init__(*args, **kwargs)
- for field in self.fields.values():
- field.widget.attrs.update({"readonly": True})
-
-