Example #1
0
    def post(self, request):
        with transaction.commit_on_success():
            sandbox = Sandbox()
            testuser = sandbox.create_user('testuser', 'Test User')
            sandbox.subject.admins.add(testuser)
            period = sandbox.create_period('approx-spring2013', 'Spring 2013')
            period.relatedexaminer_set.create(user=testuser)

            return redirect('devilry-sandbox-createsubject-success',
                unique_number=str(sandbox.unique_number))
    def handle(self, *args, **options):
        with transaction.commit_on_success():
            sandbox = Sandbox()
            test = sandbox.create_user('test', 'Test User')

            subject = sandbox.create_subject(short_name=options['subject_shortname'],
                                             long_name=options['subject_longname'])

            period = sandbox.create_period(subject, short_name='fall2012',
                                           long_name='Fall 2012')

            if options['subjectadmin']:
                subject.admins.add(test)
            else:
                period.admins.add(test)
    def handle(self, *args, **options):
        with transaction.commit_on_success():
            sandbox = Sandbox()
            test = sandbox.create_user('test', 'Test User')

            subject = sandbox.create_subject(
                short_name=options['subject_shortname'],
                long_name=options['subject_longname'])

            period = sandbox.create_period(subject,
                                           short_name='fall2012',
                                           long_name='Fall 2012')

            if options['subjectadmin']:
                subject.admins.add(test)
            else:
                period.admins.add(test)