Comments (3)
That's nuts, I can't even imagine why it would happen. You're not going through the Pick layer for the ChildInfo
. You're manually instantiating it. So I have no explanation.
Should be pretty easy to reproduce with a test in tests/serialization.py
. See if you can take a stab then just run pytest
.
from reactivated.
You can also just do the reverse relationship, far easier:
Add related_name="children"
to the parent = models.ForeignKey
declaration. See https://docs.djangoproject.com/en/5.0/ref/models/fields/#django.db.models.ForeignKey.related_name
Then just pick right at the parent level:
Pick[models. ParentModel, "id", "children.id", "children.description"]
And you only need to load the parent and pass it to the template. Magic!
PS. Technically you don't need a related name, just childmodel_set
already exists on the parent model. But I don't like that name as much.
from reactivated.
Realised that my design was probably flawed here. Instead I opted to use pick on the child and do the query on the view & this bug doesn't happen there:
@template
class View(NamedTuple):
parent: Pick[models. ParentModel, "id", "children_info"]
children: List[Pick[models. childModel, "id", "description"]]
And then doing the fetch within the view:
parent = get_object_or_404(
models.ParentModel, org=request.user.current_org, id=prompt_id
)
children = get_list_or_404(
models.ChildModel, parent=parent
)
return templates.View(
parent=parent,
children=children,
).render(request)
from reactivated.
Related Issues (20)
- Nix install `Error: Could not find a version that satisfies the requirement reactivated==0.27.2` HOT 3
- How do you do auth like is_authenticated with this? HOT 1
- Using reactivated to power dynamic forms
- Nix-shell install seems incomplete (error about no package.json) HOT 2
- Error installing reactivated on WSL2/Windows with Nix: invalid database permissions HOT 6
- scripts/launch.sh Errors
- How to access postgres from host
- Basic Setup Failing HOT 7
- Consider not using nix HOT 4
- How to use PostCSS plugins with Reactivated HOT 9
- Migrations not applying/can't exec into container HOT 5
- Website broken HOT 1
- version 0.38.0 broke our dev environmen HOT 2
- Client generation fails with unnamed URLs HOT 1
- Typing error > python3.9 HOT 2
- nix setup script fails on MacOS HOT 13
- Issues integrating in existing Django App HOT 3
- Issue finding npm path HOT 3
- Error in Setup process (failed to create symbolic link) HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactivated.