3

The Manager, objects, is ignoring not null. I´m using Python 3.6.8, Django 3.0.5 and Sqlite.

class Notificacao(models.Model):
    titulo = models.CharField('Título', max_length=255)
    categoria = models.CharField(max_length=20, choices=Categoria.choices)
    descricao = models.TextField('Descrição')
    endereco = models.CharField('Endereço', max_length=255, blank=True, null=True)
    localizacao = models.CharField('Localização', max_length=21)

When I´m trying to create an empty object, it's created. But I have required fields.

In [1]: from endemias.models import Notificacao

In [2]: Notificacao.objects.create()
Out[2]: <Notificacao: >
eldernode
  • 81
  • 9

0 Answers0