class UserForm(forms.Form): username = forms.CharField() email = forms.EmailField() first_name = forms.CharField(required=False) last_name = forms.CharField(required=False) superuser = forms.BooleanField() active = forms.BooleanField()
class UserForm(forms.Form): username = forms.SlugField() email = forms.EmailField(required=False) first_name = forms.CharField(required=False) last_name = forms.CharField(required=False) superuser = forms.BooleanField() active = forms.BooleanField() joined = forms.DateTimeField(readonly=True, required=False) groups = RelationshipField('groups', multiple=True, required=False)
class TaskForm(forms.Form): model = 'tasks' subject = forms.CharField() done = forms.BooleanField(default=False) assigned = RelationshipField('people', required=False) enum_field = forms.ChoiceField(options=TestEnum, default='opt1') desc = forms.CharField(required=False)
class TaskForm(forms.Form): subject = forms.CharField(required=True) done = forms.BooleanField(default=False) assigned = odm.RelationshipField('person', label='assigned', required=False) enum_field = forms.EnumField(enum_class=TestEnum, default=TestEnum.opt1)
class PageForm(forms.Form): path = forms.CharField(required=False) title = forms.CharField() description = forms.TextField(required=False) template = odm.RelationshipField(template_model, label='template') published = forms.BooleanField(required=False) layout = forms.JsonField(text_edit=json.dumps({'mode': 'json'})) def clean_layout(self, value): if not isinstance(value, dict): raise forms.ValidationError('Layout must be a dictionary') layout = {} if 'components' in value: components = value['components'] if not isinstance(components, list): raise forms.ValidationError('componets must be a list') layout['components'] = components if 'rows' in value: rows = value['rows'] if not isinstance(rows, list): raise forms.ValidationError('rows must be a list') layout['rows'] = rows return layout
class OrgMemberForm(forms.Form): role = forms.ChoiceField(options=MemberRole, default=MemberRole.member.name) private = forms.BooleanField(required=False)
class ObjectiveForm(forms.Form): subject = forms.CharField(required=False) deadline = forms.CharField(required=False) outcome = forms.CharField(required=False) done = forms.BooleanField(default=False)
class CreateProject(forms.Form): name = forms.SlugField(min_length=2, max_length=32, validator=ownership.UniqueField('projects')) subject = forms.CharField(max_length=250, required=False) private = forms.BooleanField()