-2
status = models.IntegerField(choices=list(CAMPAIGN_STATUS), default=CAMPAIGN_STATUS.PAUSE,
          verbose_name=_("status"), blank=True, null=True)

What is the difference in blank=True, null=True ?

ArK
  • 20,698
  • 67
  • 109
  • 136
  • 2
    [Why are Stack Overflow users more passionate about Stack Overflow than helping people?](http://meta.stackoverflow.com/q/315018/1324033) – Sayse Jun 24 '16 at 06:48
  • 2
    1. Please don't blame your lack of research on me, its literally the first result on google. and 2. Believe me, If i cared about reputation as much as you think I do it would be *a lot* higher than it is. – Sayse Jun 24 '16 at 06:49
  • it is my very first post in stack overflow you have to guide me not to degrade me – Asad Ur Rehman Jun 24 '16 at 06:53
  • 1
    No I don't, New users have to click a checkbox at the bottom of the How to Ask page indicating that they understand what they just read, before they can post their first question. So you will have already stated that you understand how to ask a valid question. If you wish to disagree further, I invite you to ask a question on [meta] – Sayse Jun 24 '16 at 06:56

1 Answers1

9

blank=True is about validation, True means that field is not required. null=True allows you to save a null value.
Also you are not always need to define both of them when you want optional field. String value, like a CharField or a TextField are better be stored in an empty string, so you should use only blank=True.
In your case, with not required IntegerField you should use both blank and null
here the docs

Ivan Semochkin
  • 8,649
  • 3
  • 43
  • 75