django(66)
-
Django filter count()
data = Trained_Image.objects.filter(file__iregex=r'kor2.*exp0.tif').count() 결과는 그냥 숫자로 나옴
2021.04.04 -
django.db.utils.OperationalError: user-defined function raised exception
정규식에서 앞자리에 '*'를 사용하면 저리 에럭 남(정말.. 시간 많이 깨먹음) data = Trained_Image.objects.filter(file__iregex=r'*kor2.*exp0.tif')
2021.04.04 -
Django group by Count함수, order by(정렬)
쿼리 select char,count(char) total from Trained_Box where status='registered' group by char order by total desc 결과 def dashboard(request) : template = 'ocr/dashboard.html' chars = Trained_Box.objects.filter(status='registered').values('char').annotate(total=Count('char')).order_by('-total') print(chars) results = { 'results' : chars } print(results) return render(request, template, results)
2021.04.03 -
Django context must be a dict rather than QuerySet.
render에 QuerySet을 전달해서 발생한 오류 def dashboard(request) : template = 'ocr/dashboard.html' chars = Trained_Box.objects.filter(status='registered').values('char').annotate(total=Count('char')).order_by('-total') return render(request, template, chars) 결과 수정 def dashboard(request) : template = 'ocr/dashboard.html' chars = Trained_Box.objects.filter(status='registered').values('char').annotate(total=Co..
2021.04.03 -
Django view에 template 적용한 화면 추가
view.py에 화면 하나 추가 def tesseract(request) : template = 'ocr/tesseract/index.html' return render(request, template, None)
2021.03.28 -
Django admin 위치
파이썬 설치위치\Lib\site-packages\django\contrib\admin
2021.03.27