Commits

Matthew Schinckel  committed c88aa5f

Don't show 'extra' fields if they are null

  • Participants
  • Parent commits a033d0e

Comments (0)

Files changed (1)

File rest_api/serializers.py

                             temp = temp()
                 # Not sure if this test should be here. Do we want to
                 # exclude extra fields if they are null?
-                #if temp is not None and api_model and field not in api_model.extra_fields:
-                this[field] = temp
+                if temp is not None or (api_model and field not in api_model.extra_fields):
+                    this[field] = temp
             data.append(this)
         if single:
             data = data[0]
     
     if kwargs.get('python'):
         return data
-        
+    
+    # We want to make null DecimalFields into "" ?
     return DjangoJSONEncoder(**kwargs).encode(data)