コード例 #1
0
ファイル: views.py プロジェクト: ianmccon/schools
def update_test_result(request, course_id, object_id):
    def acl(formset):
        for f in formset.forms:
            f.limit_to_course(course) 
    test = get_object_or_404(TestingTerm, pk=object_id)
    course = get_object_or_404(Course, pk=course_id)
    inlines = [{'model':TestResult, 'extra':1, 'form':EditTestResultForm}]
    return update_object(request, obj=test, model=TestingTerm,form_class=TestingTermForm,
                         template_name='student_testing/update_testing_term.html', 
                         extra_context={'course':course,}, 
                         inlines=inlines, preprocess_formset=acl)
コード例 #2
0
ファイル: views.py プロジェクト: ianmccon/schools
def lesson_attendance(request, course_id, object_id):
    course = get_object_or_404(Course, pk=course_id)
    lesson = get_object_or_404(course.lesson_set, pk=object_id)
    lesson.fill_attendance()
    lesson_assign_attendees.send(sender=lesson_attendance, lesson=lesson)
    attendee_form_class = PreProcessForm(LessonAttendeeForm, lambda form:form.limit_to_course(course))
    inlines = [{'model':LessonAttendee, 'form':attendee_form_class, 'extra':1}]
    return update_object(request, obj=lesson, form_class=LessonRealizedForm,
                         template_name='courses/lesson_attendance.html',
                         extra_context={'course':course},
                         inlines=inlines, post_save_redirect=lesson.get_attendance_url())
コード例 #3
0
ファイル: views.py プロジェクト: ianmccon/schools
def expensegroup_update(request, course_id, object_id):
    course = get_object_or_404(Course, pk=course_id)
    inlines = [{'model':ExpenseGroupPrice, 'extra':1}]
    return update_object(request, model=ExpenseGroup, object_id=object_id, extra_context={'course':course, }, inlines=inlines)
コード例 #4
0
ファイル: views.py プロジェクト: ianmccon/schools
def coursemember_update(request, course_id, object_id):
    course = get_object_or_404(Course, pk=course_id)
    get_object_or_404(course.coursemember_set, pk=object_id)
    inlines = [{'model':CourseMemberReference, 'extra':1, 'form':CourseMemberReferenceForm}]
    return update_object(request, model=CourseMember, form_class=CourseMemberForm, object_id=object_id, extra_context={'course':course}, inlines=inlines)
コード例 #5
0
ファイル: views.py プロジェクト: ianmccon/schools
def course_update(request, object_id):
    course = get_object_or_404(Course, pk=object_id)
    return update_object(request, model=Course, object_id=object_id, extra_context={'course':course})
コード例 #6
0
ファイル: views.py プロジェクト: ianmccon/schools
def lesson_update(request, course_id, object_id):
    course = get_object_or_404(Course, pk=course_id)
    return update_object(request, model=Lesson, form_class=LessonPlanForm, object_id=object_id, extra_context={'course':course, })
コード例 #7
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def building_update(request, object_id):
    inlines = [{'model':Classroom}, {'model':BuildingMonthExpense, 'extra':1}]
    context = {'building':get_object_or_404(Building, pk=object_id)}
    return update_object(request, model=Building, object_id=object_id, form_class=BuildingForm, extra_context=context, inlines=inlines)
コード例 #8
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def lector_update(request, *args, **kwargs):
    kwargs['extra_context'] = kwargs.get('extra_context', {})
    kwargs['extra_context']['lector'] = get_object_or_404(Lector, pk=kwargs['object_id'])
    return update_object(request, *args, **kwargs)
コード例 #9
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def lector_contract_update(request, lector_id, object_id):
    lector = get_object_or_404(Lector, pk=lector_id)
    return update_object(request, model=Contract, object_id=object_id, form_class=ContractForm, inlines=LECTOR_INLINES, extra_context={'lector':lector})
コード例 #10
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def student_update(request, object_id):
    return update_object(request, object_id=object_id, model=Student, 
                         form_class=StudentForm,
                         extra_context={'student':get_object_or_404(Student, pk=object_id)})
コード例 #11
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def company_user_update(request, company_id, object_id):
    return update_object(request, object_id = object_id, form_class = CompanyUserForm, model = User, extra_context = {'company':get_object_or_404(Company, pk=company_id)}, template_name = 'companies/company_user_form.html',
                         post_save_redirect = reverse('companies_company_user_update', args=(company_id, object_id,)))
コード例 #12
0
ファイル: views.py プロジェクト: ankitjainin/schools-2
def company_update(request, *args, **kwargs):
    kwargs['extra_context'] = kwargs.get('extra_context', {})
    kwargs['extra_context']['company'] = get_object_or_404(Company, pk=kwargs['object_id'])
    return update_object(request, *args, **kwargs)