예제 #1
0
파일: web.py 프로젝트: rf9/robox
    def form_valid(self, form):
        files = self.request.FILES
        barcode = form.cleaned_data['barcode']

        database_files = upload_files(barcode, [file for file_key in files.keys() for file in files.getlist(file_key)])

        return HttpResponseRedirect(reverse('view', kwargs={'barcode': database_files[0].barcode}))
예제 #2
0
파일: web.py 프로젝트: rf9/robox
def upload_by_barcode(request, barcode):
    files = request.FILES

    database_files = upload_files(barcode, [
        file for file_key in files.keys() for file in files.getlist(file_key)
    ])

    return HttpResponseRedirect(
        reverse('view', kwargs={'barcode': database_files[0].barcode}))
예제 #3
0
파일: web.py 프로젝트: rf9/robox
    def form_valid(self, form):
        files = self.request.FILES
        barcode = form.cleaned_data['barcode']

        database_files = upload_files(barcode, [
            file for file_key in files.keys()
            for file in files.getlist(file_key)
        ])

        return HttpResponseRedirect(
            reverse('view', kwargs={'barcode': database_files[0].barcode}))
예제 #4
0
    def create(self, request, *args, **kwargs):
        barcode = request.data.get('barcode')
        files = request.FILES

        try:
            validate_barcode(barcode)

            database_files = upload_files(barcode, [file for file in files.values()])

            return Response({"results": [FileSerializer(database_file).data for database_file in database_files]},
                            status=client.CREATED)
        except ValidationError:
            return Response({'error': 'Invalid barcode', 'barcode': barcode}, status=client.UNPROCESSABLE_ENTITY)
예제 #5
0
파일: web.py 프로젝트: rf9/robox
def upload_by_barcode(request, barcode):
    files = request.FILES

    database_files = upload_files(barcode, [file for file_key in files.keys() for file in files.getlist(file_key)])

    return HttpResponseRedirect(reverse('view', kwargs={'barcode': database_files[0].barcode}))