Closed david-waterworth closed 8 months ago
This doesn't appear to be a bug per se but I can see how the documentation doesn't make it clear what to do here. LookupField will always return the list of values it gets back from the API. Try this instead; if that also doesn't work, then we've probably got a bug:
class Template(Model):
template_category = F.LinkField[Category]("template_category", Category)
equipment_types = F.LinkField[EquipmentType](
field="equipment_types (from template_category)",
model=EquipmentType,
readonly=True
)
Thanks @mesozoic - that works!
I'm trying to generate a model from an existing airtable schema. I'm having trouble modelling a chain where a
LookupField
references a field in a linked table, where the referenced field is itself aLinkField
to a third table.i.e. in the schema below, Template.equipment_types does a lookup of the linked
Category.equipment_types
, and this field is itself linked toEquipmentType
If I materialise a Category, i.e.
Category.from_id("XXX")
, theequipment_types
field is a list ofEquipmentType
But if I materialise a Template,
equipment_types
is a list ofstr
containing EquipmentType ids and I have perform an additional request to get the actual entities.Is this a bug, not supported or am I doing something incorrect?