django-ddp
django-ddp copied to clipboard
Serializer fails for ForeignKey fields with db_column set to field name.
The default serializer fails to return a value for the foo
field of the Bar
model in following:
from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=10)
class Bar(models.Model):
foo = models.ForeignKey('Foo', db_column='foo')
@tysonclugg - I wanted to take a look at this issue today, but I can't recreate the problem. It works just fine for me when using db_column on a ForeignKey.
What error or problem do you see with the serializer with this?
Line https://github.com/jazzband/django-ddp/blame/develop/dddp/api.py#L435 sets fields[field.column]
but then line https://github.com/jazzband/django-ddp/blame/develop/dddp/api.py#L438 runs fields.pop(field.name)
. If field.column is the same as field.name, then it has popped the value we just set.