정말 당신은 User
객체를 서브 클래스와 검증에게 correct
방법을 추가,하지만 당신은 위험하게 살고 싶은 경우에 당신은뿐만 아니라 사용자 클래스를 패치 원숭이를 시도 할 수하여야한다. 이 기본 사용자 개체가 꽤 잘 내장되어 장고에 보이기 때문에 당신은 앱의 __init__.py
파일에 넣고 있습니다
...
from django.contrib.auth.models import User
def validate_for_fs(value): # <-- If the value string doesn't meet a condition required to be a name on the filesystem then throw a ValidationError
if foo_condition_not_met:
raise ValidationError(u'foo is not true for %s' % value)
if bar_condition_not_met:
raise ValidationError(u'bar is not true for %s' % value)
for field in [f for f in User._meta.fields if f.name in ['first_name','last_name','email']]:
field.validators.append(validate_for_fs)
나는, 사용자를 서브하는 좋은 방법을 볼 수 없습니다. 여기에 제안한 전략을 적용하고 적용했습니다. 그것은 꽤 잘 작동합니다. 감사. 이안 – IanSR