Пример #1
0
class ModifyView(View):
    @method_decorator(login_required)
    @method_decorator(check_ownership(InteServiceApplication))
    @method_decorator(check_not_approved(InteServiceApplication))
    def get(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(InteServiceApplication, id=app_id)
        form = InteServiceApplicationForm(instance=app)
        return render(
            request, 'integrated_service/form.html', {
                'form': form,
                'app_id': app_id,
                'post_url':
                reverse('integrated_service:modify') + '?id=' + app_id
            })

    @method_decorator(login_required)
    @method_decorator(check_ownership(InteServiceApplication))
    @method_decorator(check_not_approved(InteServiceApplication))
    def post(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(InteServiceApplication, id=app_id)
        form = InteServiceApplicationForm(request.POST, instance=app)
        if not form.is_valid():
            return render(
                request, 'integrated_service/form.html', {
                    'form':
                    form,
                    'app_id':
                    app_id,
                    'post_url':
                    reverse('integrated_service:modify') + '?id=' + app_id
                })
        form.save()
        return HttpResponseRedirect(reverse('integrated_service:manage'))
Пример #2
0
class ModifyView(View):
    @method_decorator(login_required)
    @method_decorator(check_ownership(StudentActivityCenterApplication))
    @method_decorator(check_not_approved(StudentActivityCenterApplication))
    def get(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(StudentActivityCenterApplication, id=app_id)
        form = StudentActivityCenterApplicationForm(instance=app)
        return render(request, 'student_activity_center/form.html',
                {'form': form, 'app_id': app_id,
                 'post_url': \
                     reverse('student_activity_center:modify')+'?id='+app_id})

    @method_decorator(login_required)
    @method_decorator(check_ownership(StudentActivityCenterApplication))
    @method_decorator(check_not_approved(StudentActivityCenterApplication))
    def post(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(StudentActivityCenterApplication, id=app_id)
        form = StudentActivityCenterApplicationForm(request.POST,
                                                    request.FILES,
                                                    instance=app)
        if not form.is_valid():
            return render(request, 'student_activity_center/form.html',
                {'form': form, 'app_id': app_id,
                 'post_url': \
                     reverse('student_activity_center:modify')+'?id='+app_id})
        form.save()
        return HttpResponseRedirect(reverse('student_activity_center:manage'))
Пример #3
0
class ModifyView(View):

    @method_decorator(login_required)
    @method_decorator(check_ownership(PublicityApplication))
    def get(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(PublicityApplication, id=app_id)
        form = PublicityApplicationForm(instance=app)
        return render(request, 'campus_field/publicity/form.html', 
                {'form': form, 'app_id': app_id,
                 'post_url': \
                     reverse('publicity:modify')+'?id='+app_id})

    @method_decorator(login_required)
    @method_decorator(check_ownership(PublicityApplication))
    def post(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(PublicityApplication, id=app_id)
        form = PublicityApplicationForm(
                request.POST, request.FILES, instance=app)
        if not form.is_valid():
            return render(request, 'campus_field/publicity/form.html', 
                {'form': form, 'app_id': app_id,
                 'post_url': \
                     reverse('publicity:modify')+'?id='+app_id})
        form.save()
        return HttpResponseRedirect(reverse('publicity:manage'))
Пример #4
0
class ModifyView(View):
    @method_decorator(login_required)
    @method_decorator(check_ownership(MeetingRoomApplication))
    @method_decorator(
        check_perms('account.youth_league_committee', '非团委下属组织不能申请会议室'))
    def get(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(MeetingRoomApplication, id=app_id)
        form = MeetingRoomApplicationForm(instance=app)
        return render(
            request, 'meeting_room/form.html', {
                'form': form,
                'app_id': app_id,
                'post_url': reverse('meeting_room:modify') + '?id=' + app_id
            })

    @method_decorator(login_required)
    @method_decorator(check_ownership(MeetingRoomApplication))
    @method_decorator(
        check_perms('account.youth_league_committee', '非团委下属组织不能申请会议室'))
    def post(self, request):
        app_id = request.GET.get('id')
        app = get_object_or_404(MeetingRoomApplication, id=app_id)
        form = MeetingRoomApplicationForm(request.POST, instance=app)
        if not form.is_valid():
            return render(
                request, 'meeting_room/form.html', {
                    'form': form,
                    'app_id': app_id,
                    'post_url':
                    reverse('meeting_room:modify') + '?id=' + app_id
                })
        form.save()
        return HttpResponseRedirect(reverse('meeting_room:manage'))