django-elasticsearch-dsl
django-elasticsearch-dsl copied to clipboard
Allow prepare_field for nested objects in an object field
I need a prepare method on the field inside a Object field. It would be really nice if I could just use double underscore notation and just create a prepare method.
Something like this:
class CarDocument(DocType):
model = fields.ObjectField(properties={
'make': fields.KeywordField(),
}),
@staticmethod
def prepare_model__make(instance):
#doing things here would be nice!
Are there any updates regarding this?
How did you manage to prepare model.make
?
Why dont you just prepare the objectfield and return the value as dictionary? something like
def prepare_model(self, instance):
return {"make": instance.model.make}
I ended up doing that, @safwanrahman I just think it'd be cool to have support for specific nested fields
Any Updates?
@Vikku14 have you found a workaround for this please?