Esempio n. 1
0
    def test_parse_form(self):
        with open(os.path.join(os.path.dirname(__file__), 'test_form.txt')) as f:
            text = f.read()

        form_class = parse_form(text)
        self.assertIn(forms.BaseForm, form_class.__bases__)
        form = form_class() 
        self.assertEquals(4, len(form.fields))
Esempio n. 2
0
    def get_form_class(self):
        # TODO: refactor
        from q13es.forms import parse_form

        return parse_form(self.q13e)
Esempio n. 3
0
)

FORM_NAMES = (
    'personal-details',
    'about',
    'public-profiles',
    'work-experience',
    'programming-langs',
    'software-development',
    'web-technologies',
    'social-activity',
    'cohort1',
    'program',
    )

FORMS = {k: parse_form(read_file(k), CUSTOM_FIELD_TYPES) for k in FORM_NAMES}


def get_user_forms(user):
    return user.answers.values_list('q13e_slug', flat=True)


def get_user_next_form(user):

    filled = get_user_forms(user)

    for f in FORM_NAMES:
        if f not in filled:
            return f

    return None
Esempio n. 4
0
 def get_form_class(self):
     return parse_form(self.q13e)