# summary = forms.CharField(required=True)
# template = forms.ModelChoiceField(Template.objects, required=False)
#
- # class Meta:
- # model = Book
- # exclude = ['parent', 'parent_number', 'project', 'gallery', 'public']
- #
# def __init__(self, *args, org=None, **kwargs):
# super(DocumentCreateForm, self).__init__(*args, **kwargs)
- # self.fields['slug'].widget.attrs={'class': 'autoslug'}
# self.fields['title'].widget.attrs={'class': 'autoslug-source'}
# self.fields['template'].queryset = Template.objects.filter(is_main=True)
#
# def clean(self):
# super(DocumentCreateForm, self).clean()
# template = self.cleaned_data['template']
- # self.cleaned_data['gallery'] = self.cleaned_data['slug']
#
# if template is not None:
# self.cleaned_data['text'] = template.content
return self.cleaned_data
-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})
-
-
class ChooseMasterForm(forms.Form):
"""
Form used for fixing the chunks in a book.