파이썬/Django(108)
-
Django Admin 에러
데이터 타입이 IntergerField인데, 값을 강제로 ''으로 셋팅하여 생긴 문제 값을 null로 셋팅하면 해결됨 Django Version:3.1.6 Exception Type:IndexError Exception Value: string index out of range Exception Location:C:\Users\baris\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\numberformat.py, line 57, in format
2021.02.21 -
Django queryset distinct
queryset에서 'char' 컬럼에 대해서 distinct 적용 chares = list(set(boxes.values_list('char', flat=True).distinct()))
2021.02.20 -
Django PostgreSQL 연동시 에러
connection 정보중 일부가 정확하지 않아서 생긴 문제 conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError
2021.02.19 -
Django filter 특징
BinaryField는 filter 적용 안됨 null은 ''로 인식됨 : filter(a='')
2021.02.17 -
Django Admin change_form.html에 버튼 추가 및 저장시 custom 작업 수행
{% block submit_buttons_bottom %} {{ block.super }} {% endblock %} def response_change(self, request, obj): if "_gotoTrainedBoxes" in request.POST or "_gotoTrainedBoxes(include Image)" in request.POST : if "_gotoTrainedBoxes(include Image)" in request.POST : Trained_Image.createImageData(obj) opts = self.model._meta msg = format_html('The Trained_Image “{}” was changed successfully.', obj.id) se..
2021.02.12 -
Django Admin list_display에 custom link 추가
list_display = ['id','linkImage',] def linkImage(self, obj) : url = reverse('admin:ocr_trained_image_change', args=[obj.image]) return format_html("{}",url,obj.image) linkImage.short_description = 'Image' list_display = ['id','popup_gantt','manager'] def popup_gantt(self, obj) : return format_html("{}", obj.id,obj.name)
2021.02.11