Changes between Version 5 and Version 6 of NewbieMistakes


Ignore:
Timestamp:
Sep 28, 2005, 1:06:31 PM (19 years ago)
Author:
craig@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewbieMistakes

    v5 v6  
    3131
    3232Add a {{{__repr__()}}} function to all your models. Make it a habit so it becomes automatic.
     33
     34== Integer & NULLS ==
     35
     36==== Problem ====
     37
     38When you have a Field: current_zip = meta.IntegerField(maxlength=5,blank=True)
     39
     40django will create a not nullable field in the DB.  However leaving the field blank (in admin/web) django will try and insert a NULL value in the DB.
     41
     42==== Solution ====
     43
     44Add null=True:
     45
     46current_zip = meta.IntegerField(maxlength=5,null=True,blank=True)
Back to Top