Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
class OrgMemberForm(forms.Form):
    role = forms.ChoiceField(options=MemberRole,
                             default=MemberRole.member.name)
    private = forms.BooleanField(required=False)
Ejemplo n.º 7
0
class ObjectiveForm(forms.Form):
    subject = forms.CharField(required=False)
    deadline = forms.CharField(required=False)
    outcome = forms.CharField(required=False)
    done = forms.BooleanField(default=False)
Ejemplo n.º 8
0
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()