MCPcopy Index your code
hub / github.com/fastapi-admin/fastapi-admin / render

Method render

fastapi_admin/widgets/inputs.py:135–142  ·  view source on GitHub ↗
(self, request: Request, value: Any)

Source from the content-addressed store, hash-verified

133 return await self.model.all()
134
135 async def render(self, request: Request, value: Any):
136 options = await self.get_options()
137 selected = list(map(lambda x: x.pk, value.related_objects if value else []))
138 for option in options:
139 if option.get("value") in selected:
140 option["selected"] = True
141 self.context.update(options=json.dumps(options))
142 return await super(Input, self).render(request, value)
143
144
145class Enum(Select):

Callers

nothing calls this directly

Calls 2

get_optionsMethod · 0.95
renderMethod · 0.45

Tested by

no test coverage detected