'Cannot assign "%r": the current database router prevents this relation.' % value)
2021. 1. 7. 18:16ㆍ파이썬/Django
https://code.djangoproject.com/ticket/20337
In my router, the allow_relation method was set incorrectly, and as a result, two models from separate apps weren't allowed to reference each other. The ValueError I received looked like this:
routers.py에 아래 내용 추가
def allow_relation(self, obj1, obj2, **hints) :
if obj1._meta.app_label == 'auth' or obj2._meta.app_label == 'auth' :
return True
return None
'파이썬 > Django' 카테고리의 다른 글
Django Admin에 버튼 추가 (0) | 2021.01.07 |
---|---|
QuerySet 참조 (0) | 2021.01.07 |
관련 문의 (0) | 2021.01.07 |
Django import export 참고자료 (0) | 2021.01.06 |
Django admin custom filter (0) | 2020.12.30 |