Django (3) 썸네일형 리스트형 장고 User 모델 커스텀하기 장고엔 이미 구현된 로그인 기능이 있다. 유저를 표현하기 위한 주요 attribute들은 다음과 같다. username password email first_name last_name docs.djangoproject.com/en/3.1/topics/auth/default/ Using the Django authentication system | Django documentation | Django Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donate docs.djangoproject.com 그런데 로그인한 유저의 정보를.. Django Inspectdb 기능 legacy DB를 장고 서버에서 사용해야 할 상황이 생겼다. 그런데, 장고에서는 DB에 접근하기 위해 모델을 사용하기 때문에 DB 테이블을 모델로 바꿔야 하는 작업이 필요하다. 하지만 장고에서 고맙게도 이런 기능을 지원해준다. 공식문서 링크 : docs.djangoproject.com/en/3.1/howto/legacy-databases/ Integrating Django with a legacy database | Django documentation | Django Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donat.. Django Model _set 메서드에 관하여 Django에서 Model을 다른 모델에서 Foreign Key로 참조하여 선언 후 migration하게 되면, 내가 생성한 적이 없는 [Model 이름]_set이란 메서드가 생성된걸 알 수 있다. 장고에서는 모델이 다른 모델에서 외래 키로 참조됐을 때, 참조한 모델과 대응되는건 하나밖에 없기 때문에 이런 관계를 표현하기 쉽도록 인터페이스화 해놓았다. 이해를 돕기 위해 예시를 들어보겠다. class Question(models.Model): subject = models.CharField(max_length=200) content = models.TextField() create_date = models.DateTimeField() class Answer(models.Model): question = m.. 이전 1 다음