- 필수 기능
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- 디지털 경험
- 소프트웨어 제공
- 보안
- 로그 관리
- 관리
- 인프라스트럭처
- ci
- containers
- csm
- ndm
- otel_guides
- overview
- slos
- synthetics
- tests
- 워크플로
ID: python-django/no-unicode-on-models
언어: 파이썬(Python)
심각도: 경고
범주: 모범 사례
Django 모델에서 __unicode__
를 사용하지 마세요. __unicode__
필드는 Python 2에서 사용됩니다. 대신 __str__
을 사용하세요. __str__
는 Python 3에서 사용됩니다.
class Person(models.Model):
def __unicode__(self): # __unicode__를 정의하지 마시고, __str__을 정의하세요.
pass
class Person(models.Model):
def __str__(self):
"person"