티스토리 뷰
[ERROR] 'id' can only be used as a field name if the field also sets 'primary_key=True'
adore_voy 2020. 11. 6. 15:08상황
- 로그인 아이디와 비밀번호를 입력하려고, 필요한 장고 모델을 생성하려고 함.
때문에, 'id'와 'password'라는 이름의 데이터베이스를 만들기로 했다.
그리고 마이그레이션을 하려고 하는 중,


이러한 에러 발생
찾은방법들
groups.google.com/g/django-users/c/h4s36KNOt9M?pli=1
inspectDB and 'id' can only be used as a field name if the field also sets 'primary_key=True'.
G'day, Very new to Django, I'm trying to connect to an existing MySQL database that I am not familiar with. I used inspectDB to load up the database models.py file, and am seeing these errors for some of the tables : 'id' can only be used as a field name
groups.google.com
해결방법
id는 이미 장고모델이 제공하는 키였다. 때문에, 이름을 수정해야함.
그렇기에 id는 trinity_id로, password는 trinity_password로 수정했다.
이렇게 이미 있는 명령어나 문법이 아닐지 헷갈리거나 의심되는 경우에 사용하고자 하는 변수명 앞에 _를 붙이는 방법이 있다고 한다.

성공.
'ERROR COLLECTION' 카테고리의 다른 글
[ERROR] 'react-scripts'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다. (0) | 2021.02.01 |
---|---|
[ERROR] Django에서 querySelector이나 getElementById가 null이 되는 이슈 (0) | 2020.11.24 |
[ERROR] '' form object has no attribute is_valid (2) | 2020.11.10 |
[ERROR] NameError: name 'os' is not defined (0) | 2020.11.02 |
[ERROR] Python:command 'python.setInterpreter' not found (0) | 2020.11.02 |
- Total
- Today
- Yesterday
- nextjs 스크롤
- 화이팅
- 리액트 컴포넌트
- NextJS
- 리액트 스크롤
- Til
- css marquee
- 리액트 라우터
- 자바스크립트
- bs4 크롤링
- 파이썬 flask
- 리액트
- dvd 효과
- 파이썬 크롤링
- react router
- vscode venv
- 움직이는 글래스모피즘
- nextjs 파라미터 넘기기
- next.js 리다이렉트
- 글래스모피즘 애니메이션 구현
- 리액트 파라미터 넘기기
- 백준 10989 파이썬
- 글래스모피즘 구현
- 파이썬 정렬
- nuxt 공식문서
- css 글래스모피즘
- nuxt 공식문서 한글
- getserversideprops redirect
- 카페음료테스트
- 10989 파이썬
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |