django-content-settings icon indicating copy to clipboard operation
django-content-settings copied to clipboard

`additional_attributes` for `DjangoModelTemplate`

Open oduvan opened this issue 1 year ago • 0 comments

The idea here is that customer can pass additional arguments to the function call, which will be passed to the template context.

Those attributes are optional, and if those haven't been passed, that means that they should be calculated based on primary model object.


DjangoModelTemplate(
    additional_attributes={
          "final_quest": lambda obj: get_final_quest()
    }
)

In the context it still one object, but with proxy cover, where attributes will be taken from the passed

oduvan avatar Jan 11 '24 10:01 oduvan