示例#1
0
    def get(self, *args, **kwargs):
        form_list = audit()

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms))
示例#2
0
    def get(self, *args, **kwargs):
        user_is_clerk = is_clerk(self.request.user)
        form_list = forms_for_user(user_is_clerk)
        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms, is_clerk=user_is_clerk))
示例#3
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects.exclude(
            form_state=FormState.UNSUBMITTED)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(forms=forms))
示例#4
0
    def get(self, *args, **kwargs):
        user_is_clerk = is_clerk(self.request.user)
        form_list = forms_for_user(user_is_clerk)
        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms, is_clerk=user_is_clerk))
示例#5
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects.filter(form_state=FormState.CLEARANCE)
        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms,
                                  is_clerk=is_clerk(self.request.user)))
示例#6
0
    def get(self, *args, **kwargs):
        all_checks = QuarantineCheck.objects.all().order_by('id')

        checks = paging(all_checks, self.request)

        return self.render_to_response(self.get_context_data(
            checks=checks))
示例#7
0
    def get(self, *args, **kwargs):
        all_checks = QuarantineCheck.objects.all().order_by('id')

        checks = paging(all_checks, self.request)

        return self.render_to_response(self.get_context_data(
            checks=checks))
示例#8
0
    def get(self, *args, **kwargs):
        # check cache
        candidate_list = Candidate.objects.all()
        candidates = paging(candidate_list, self.request)

        return self.render_to_response(
            self.get_context_data(candidates=candidates,
                                  remote_url='candidate-list-data'))
示例#9
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects.exclude(
            form_state=FormState.UNSUBMITTED)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms))
示例#10
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = ResultForm.objects.filter(form_state=FormState.CLEARANCE, tally__id=tally_id)
        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms, is_clerk=is_clerk(self.request.user),
            tally_id=tally_id))
示例#11
0
    def get(self, *args, **kwargs):
        # check cache
        tally_list = Tally.objects.all()
        tallies = paging(tally_list, self.request)

        return self.render_to_response(self.get_context_data(
            tallies=tallies,
            remote_url='tally-list-data'))
示例#12
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = get_results_duplicates(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms, tally_id=tally_id))
示例#13
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        ballots = self.get_per_ballot_progress()

        ballots = paging(ballots, self.request)

        return self.render_to_response(
            self.get_context_data(ballots=ballots, tally_id=tally_id))
示例#14
0
    def get(self, *args, **kwargs):
        # check cache
        station_list = Station.objects.all()
        stations = paging(station_list, self.request)

        return self.render_to_response(self.get_context_data(
            stations=stations,
            remote_url='center-list-data'))
示例#15
0
    def get(self, *args, **kwargs):
        # check cache
        station_list = Station.objects.all()
        stations = paging(station_list, self.request)

        return self.render_to_response(
            self.get_context_data(stations=stations,
                                  remote_url='center-list-data'))
示例#16
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        ballots = self.get_per_ballot_progress()

        ballots = paging(ballots, self.request)

        return self.render_to_response(
            self.get_context_data(
                ballots=ballots, tally_id=tally_id))
示例#17
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = get_results_duplicates(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(
                self.get_context_data(forms=forms,
                    tally_id=tally_id))
示例#18
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects.exclude(
            form_state=FormState.UNSUBMITTED)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms,
            tally_id=kwargs['tally_id'],
            remote_url=reverse('form-progress-data', kwargs={'tally_id': kwargs['tally_id']})))
示例#19
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = audit(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms,
            tally_id=tally_id,
            remote_url=reverse('form-audit-data', args=[kwargs['tally_id']])))
示例#20
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = clearance(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms,
            tally_id=tally_id,
            remote_url=reverse('form-clearance-data', kwargs={'tally_id': tally_id})))
示例#21
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects
        if is_clerk(self.request.user):
            form_list = form_list.filter(form_state=FormState.CLEARANCE)
        else:
            form_list = form_list.filter(Q(form_state=FormState.CLEARANCE) |
                                         Q(form_state=FormState.CLEARANCE_PENDING_STATE))
        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms, is_clerk=is_clerk(self.request.user)))
示例#22
0
    def get(self, *args, **kwargs):
        # check cache
        tally_id = kwargs['tally_id']

        candidate_list = Candidate.objects.filter(tally__id=tally_id)
        candidates = paging(candidate_list, self.request)

        return self.render_to_response(self.get_context_data(
            candidates=candidates,
            remote_url=reverse('candidate-list-data', kwargs={'tally_id': tally_id}),
            tally_id=tally_id))
示例#23
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = duplicates(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms,
            tally_id=tally_id,
            remote_url=reverse('form-duplicates-data',
                kwargs={'tally_id': kwargs['tally_id']})))
示例#24
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = duplicates(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(
                forms=forms,
                tally_id=tally_id,
                remote_url=reverse('form-duplicates-data',
                                   kwargs={'tally_id': kwargs['tally_id']})))
示例#25
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = audit(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms,
                                  tally_id=tally_id,
                                  remote_url=reverse('form-audit-data',
                                                     args=[kwargs['tally_id']
                                                           ])))
示例#26
0
    def get(self, *args, **kwargs):
        form_list = ResultForm.objects.exclude(
            form_state=FormState.UNSUBMITTED)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(
                forms=forms,
                tally_id=kwargs['tally_id'],
                remote_url=reverse('form-progress-data',
                                   kwargs={'tally_id': kwargs['tally_id']})))
示例#27
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        form_list = clearance(tally_id)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms,
                                  tally_id=tally_id,
                                  remote_url=reverse(
                                      'form-clearance-data',
                                      kwargs={'tally_id': tally_id})))
示例#28
0
文件: audit.py 项目: onaio/tally-ho
    def get(self, *args, **kwargs):
        format_ = kwargs.get('format')
        tally_id = kwargs.get('tally_id')
        user_is_clerk = is_clerk(self.request.user)
        form_list = forms_for_user(user_is_clerk, tally_id)

        if format_ == 'csv':
            return render_to_csv_response(form_list)

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(
            forms=forms, is_clerk=user_is_clerk,
            tally_id=tally_id))
示例#29
0
    def get(self, *args, **kwargs):
        format_ = kwargs.get('format')
        tally_id = kwargs.get('tally_id')
        form_list = ResultForm.objects.filter(form_state=FormState.CLEARANCE,
                                              tally__id=tally_id)

        if format_ == 'csv':
            return render_to_csv_response(form_list)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms,
                                  is_clerk=is_clerk(self.request.user),
                                  tally_id=tally_id))
示例#30
0
    def get(self, *args, **kwargs):
        format_ = kwargs.get('format')
        tally_id = kwargs.get('tally_id')
        user_is_clerk = is_clerk(self.request.user)
        form_list = forms_for_user(user_is_clerk, tally_id)

        if format_ == 'csv':
            return render_to_csv_response(form_list)

        forms = paging(form_list, self.request)

        return self.render_to_response(
            self.get_context_data(forms=forms,
                                  is_clerk=user_is_clerk,
                                  tally_id=tally_id))
示例#31
0
    def get(self, *args, **kwargs):
        tally_id = kwargs.get('tally_id')
        format_ = kwargs.get('format')

        if format_ and format_ == 'csv':
            station_list = Station.objects.filter(center__tally__id=tally_id)

            station_list = station_list.values(
                'center__office__name',
                'sub_constituency__code',
                'center__name',
                'center__code',
                'station_number',
                'gender',
                'registrants',
                'percent_received',
                'percent_archived',
            ).order_by('center__code')

            header_map = {
                'center__office__name': 'office name',
                'sub_constituency__code': 'subconstituency code',
                'center__name': 'center name',
                'center__code': 'center code',
            }

            return render_to_csv_response(station_list,
                                          filename='centers_and_station',
                                          append_datestamp=True,
                                          field_header_map=header_map)

        # check cache
        station_list = Station.objects.filter(center__tally__id=tally_id)
        stations = paging(station_list, self.request)

        return self.render_to_response(
            self.get_context_data(stations=stations,
                                  remote_url=reverse('center-list-data',
                                                     kwargs=kwargs),
                                  tally_id=tally_id))
示例#32
0
    def get(self, *args, **kwargs):
        form_list = duplicates()

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(forms=forms))
示例#33
0
    def get(self, *args, **kwargs):
        form_list = get_results_duplicates()

        forms = paging(form_list, self.request)

        return self.render_to_response(self.get_context_data(forms=forms))