파이썬(156)
-
Django Admin 템플릿에서 static 사용시 주의점
먼저 load를 해주지 않으면 인식이 안됨 setttings.py에서 관련정보를 가져오는 것 같음 {% extends 'admin/change_form.html' %} {% load static %} {% block canvas_start %}
2021.02.04 -
Django Built-in template tags and filters for문
VariableDescription forloop.counterThe current iteration of the loop (1-indexed) forloop.counter0The current iteration of the loop (0-indexed) forloop.revcounterThe number of iterations from the end of the loop (1-indexed) forloop.revcounter0The number of iterations from the end of the loop (0-indexed) forloop.firstTrue if this is the first time through the loop forloop.lastTrue if this is the l..
2021.02.04 -
Djang Admin widget 셋팅
formfield_overrides = { models.CharField: {'widget': forms.TextInput(attrs={'size': 1})}, models.TextField: {'widget': forms.Textarea(attrs={'rows': 1,'cols': 15})}, models.BooleanField: {'widget': forms.CheckboxInput(attrs={'value': 12})}, } widget 종류 'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'NumberInput', 'EmailInput', 'URLInput', 'PasswordInput', 'HiddenInput', 'MultipleHiddenInp..
2021.02.04 -
Django Model ForeignKey
생성할때는 객체를 넘여야 함 조회할때는 id값만 있어도 됨
2021.01.31 -
Cannot assign "25": "Box.image" must be a "Image" instance.
Model의 ForeignKey는 값이 아닌, 객체를 대입해야 함 self.image = image(X) self.image = Image.objects.get(id=image)(O)
2021.01.31 -
object has no attribute '_state'
Model 생성자 __init__ 오버로딩 에러 생성자 오버로딩은 안되는걸로
2021.01.31