728x90
반응형
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class Article(models.Model):
writer = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='arrticle')
title = models.CharField(max_length=200, null=True)
image = models.ImageField(upload_to='article/', null=False)
content = models.TextField(null=True)
created_at = models.DateField(auto_created=True, null=True)
ERRORS:articleapp.Article.writer:(fields.E320) Field specifies on_delete=SET_NULL, but cannot be null. HINT: Set null=True argument on the field, or change the on_delete rule.
해결: null=True 속성을 추가해주면 해결된다.
728x90
반응형
'ERROR' 카테고리의 다른 글
OperationalError, no such column (0) | 2021.05.02 |
---|---|
django.core.exceptions.FieldError: Unknown field(s) (content) specified for Comment (0) | 2021.05.02 |
source tree에서 push error (0) | 2021.04.25 |
yarn serve , npm run serve 시의 URIError (0) | 2021.04.21 |
npm run build 에러 (0) | 2021.04.20 |