0

In a django model, I usually take the lazy/easy way our to set all my CharFields to both null=True and blank=True. I am going to remove one, but which one is more preferable to keep? I am using MySQL by the way.

Chari Pete
  • 97
  • 8
  • 1
    Does this answer your question? [differentiate null=True, blank=True in django](https://stackoverflow.com/questions/8609192/differentiate-null-true-blank-true-in-django) – Jacob H Oct 31 '19 at 16:26
  • you can check the docs here too: (https://docs.djangoproject.com/en/dev/ref/models/fields/) – Sammy J Oct 31 '19 at 16:27

1 Answers1

0

Hi, it depends on what you want to achieve, you want to keep your data clean in your DB tables, specially if you will need it for reporting or dashboards. Anyway, for sake of your question and that the field is a Charfield, null=True is unnecesary, this type is never stored or saved as Null.

Jorge López
  • 489
  • 3
  • 17