Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional computed fields #30

Open
lallulli opened this issue Jul 1, 2024 · 2 comments
Open

Additional computed fields #30

lallulli opened this issue Jul 1, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@lallulli
Copy link

lallulli commented Jul 1, 2024

Hi. I would like to add a new field to my FeatureType, not defined in my model, whose values are computed at runtime by a generic Python function.

I was able to add a computed field by subclassing XsdElement and overriding the get_value method, but I have to bind it to an existing field of my model (thus overriding the value read from the database). If I name my additional field with a name that does not exist in my model, I get a FieldDoesNotExist exception.

@vdboor
Copy link
Contributor

vdboor commented Jan 16, 2025

Hi! Sounds like a wonderful deep-dive!

Currently the fields are indeed very bound to the model. This is a based-in assumption to support query filters on all fields. You are free to loosen this with a PR, but I suspect it might be hard work.

Since Django 5 offers a GeneratedField, this would likely be the best way to implement this. It would also allow querying the data.

@vdboor vdboor added the enhancement New feature or request label Feb 11, 2025
@Yrob
Copy link
Contributor

Yrob commented Feb 13, 2025

scheduled: 135658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants