Skip to content

Conversation

@meshy
Copy link
Contributor

@meshy meshy commented May 2, 2025

This is a step on the road of removing the ORM.

This removes ORM objects from the template context, and some logic off the models in the process. The moved code is by no means perfect, but at least it's now in a less inconvenient place.

meshy added 7 commits May 2, 2025 17:22
This is a step on the road of removing the ORM from the template render.
We had a filter that did a complex query at template render time. That
logic has now been moved to the view. Flat objects are introduced to
passed method to the template instead.

The helper function is horrible. We should also improve the method
context data structure, but that would require more work on the
template, so it's out of scope.

Similarly, this makes no effort to add types to the helper function
which was previously a template filter.
This adds a `klass` argument, and renames a couple of attributes.
Other than that, this is just a move.

This function is gnarly. Fixing it can come later.
There's no need for us to re-define this on every iteration.
@meshy meshy marked this pull request as ready for review September 14, 2025 18:07
Copy link
Contributor

@ghickman ghickman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions about essentially the same thing. I don't have a strong opinion on which way you go though, more curious to see if reducing the types are useful to you

class Class:
db_id: int
docs_url: str
docstring: str | None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could an empty string serve the same falsey/emptiness need as None here, and reduce the number of types?

name: str
value: str
overridden: bool
class_url: str | None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, about using empty string instead of None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants