Beispiel #1
0
def remove_new_indicator(request):
    im = IndicatorManagement(request)
    try:
        im.delete()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()
Beispiel #2
0
def set_receive_date(request):
    try:
        im = IndicatorManagement(request)
        im.set_received()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()
Beispiel #3
0
 def set_receiver(self, rcv):
     if not rcv:
         self.error(_('please enter person name'), True)
     hs = self.get_send_history()
     single = self.get_single_ext(True)
     if hs.filter(receiver=None).exists():
         hs2 = hs.get(receiver=None)
         hs2.receiver = rcv
         hs2.save()
         IndicatorManagement.create_send(rcv, hs2.invoice.invoice_type.name,
                                         False, self.requester.pk, single)
Beispiel #4
0
def view_indicator_file(request):
    try:
        im = IndicatorManagement(request)
        x = im.get_file().values('pk', 'ext', 'original_name',
                                 'upload_type_text', 'uploader__first_name',
                                 'uploader__username', 'uploader__pk',
                                 'user__pk', 'user__first_name',
                                 'user__username',
                                 'upload_date').order_by('-pk')
        return HttpResponse(json.dumps(list(x), default=date_handler))
    except RequestProcessException as e:
        return e.get_response()
Beispiel #5
0
def view_all_indicators(request):
    if not check_ajax(request):
        letters = LetterFile.objects.all()
        pocket = PocketBook.objects.all()
        return render(
            request, 'indicator/IndicatorManagement.html', {
                'has_nav': True,
                'letter': letters,
                'pocket': pocket,
                'uploader_address': reverse('indicator_upload')
            })
    try:
        im = IndicatorManagement(request)
        return HttpResponse(im.get_all())
    except RequestProcessException as e:
        return e.get_response()
Beispiel #6
0
def get_indicator(request):
    im = IndicatorManagement(request)
    try:
        x = im.get_single_ext(True)
        assert isinstance(x, IndicatorBook)
        res = {
            'person': x.target,
            'title': x.title,
            'has_attachment': x.has_attachment,
            'book_type': x.book_type,
            'letter': x.letter_file.ext,
            'pocket': x.pocket.ext,
            'ext': x.ext
        }
        return HttpResponse(json.dumps(res))
    except RequestProcessException as e:
        return e.get_response()
Beispiel #7
0
def add_new_indicator(request):
    im = IndicatorManagement(request)
    im.set_post()
    try:
        im.update()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()
Beispiel #8
0
def upload_indicator_attachment(request):
    try:
        im = IndicatorManagement(request)
        im.set_post()
        im.file_upload()
        return HttpResponse('200')
    except RequestProcessException as e:
        return e.get_response()