Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Adding a custom attribute to the instances #181

@matdrapeau

Description

@matdrapeau

How can we define a custom attribute for instances?

Using this route as example:

    @ItemRoute.GET
    def is_recent(self, book) -> fields.Boolean():
        return datetime.date.today().year <= book.year_published + 10

How can we define is_recent at the instances level such as:
http GET :5000/book/1 would return book attributes containing is_recent: True | False as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions