  
  @python_2_unicode_compatible
  class Category(models.Model):
      name = models.CharField(max_length=20)
  
      class Meta:
          ordering = ('name',)
  
      def __str__(self):
 
</s> remove     pass
 </s> add     @classmethod
    def WithData(cls, original_exc, model, fk, field_value):
        """
        Factory method for creating a deserialization error which has a more
        explanatory messsage.
        """
        return cls("%s: (%s:pk=%s) field_value was '%s'" % (original_exc, model, fk, field_value)) </s> remove                             value = field.remote_field.model._meta.get_field(field.remote_field.field_name).to_python(field_value)
                        data[field.attname] = value
                    else:
                        data[field.attname] = field.remote_field.model._meta.get_field(field.remote_field.field_name).to_python(field_value)
 </s> add                             data[field.attname] = field.remote_field.model._meta.get_field(field.remote_field.field_name).to_python(field_value)
                    except Exception as e:
                        raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), field_value) </s> remove                 data[field.name] = field.to_python(field_value)
 </s> add                 try:
                    data[field.name] = field.to_python(field_value)
                except Exception as e:
                    raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), field_value) </s> remove             data[Model._meta.pk.attname] = Model._meta.pk.to_python(d.get("pk", None))
 </s> add             try:
                data[Model._meta.pk.attname] = Model._meta.pk.to_python(d.get('pk'))
            except Exception as e:
                raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), None)
    meta_data = models.ForeignKey(CategoryMetaData, null=True, default=None)
  
  @python_2_unicode_compatible
  class Category(models.Model):
      name = models.CharField(max_length=20)
    meta_data = models.ForeignKey(CategoryMetaData, null=True, default=None)
  
      class Meta:
          ordering = ('name',)
  
      def __str__(self):
keep keep keep add keep keep keep keep keep
 Fixed #19820 -- Added more helpful error messages to Python deserializer. 
tests/serializers/models.py