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

sample_project: URIs are created but not linked with the entities #1473

Closed
gythaogg opened this issue Dec 4, 2024 · 4 comments · Fixed by #1480 or #1459
Closed

sample_project: URIs are created but not linked with the entities #1473

gythaogg opened this issue Dec 4, 2024 · 4 comments · Fixed by #1480 or #1459

Comments

@gythaogg
Copy link
Contributor

gythaogg commented Dec 4, 2024

https://discworld.acdh-ch-dev.oeaw.ac.at/apis_metainfo.uri/

image

@gythaogg gythaogg changed the title Sample_project: URIs are created but not linked with the entities sample_project: URIs are created but not linked with the entities Dec 4, 2024
@b1rger
Copy link
Contributor

b1rger commented Dec 4, 2024

If I create a new object in the discworld instance, it does get an URI assigned. I guess the dangling URIs are a problem with our fixtures.

@gythaogg
Copy link
Contributor Author

gythaogg commented Dec 4, 2024

Yeah I thought that must've been the case but URI data isn't in the fixture so I guess they're automatically created but not linked to the entity for whatever reason...

@b1rger
Copy link
Contributor

b1rger commented Dec 4, 2024

Yeah I thought that must've been the case but URI data isn't in the fixture so I guess they're automatically created but not linked to the entity for whatever reason...

Ah, interesting, I didn't know that the URIs are not part of the fixtures. But yes, thats weird. I wonder how the URIs are created then...

@b1rger
Copy link
Contributor

b1rger commented Dec 5, 2024

https://docs.djangoproject.com/en/5.1/topics/db/fixtures/#how-fixtures-are-saved-to-the-database says:

When fixture files are processed, the data is saved to the database as is. Model defined save() methods are not called, and any pre_save or post_save signals will be called with raw=True since the instance only contains attributes that are local to the model.

So I think with "the instance only contains attributes that are local to the model" might mean there is not foreign key to the root model (yet) and thats why the Uri gets created with the root_model pointing to None.

I'd say lets do what the documentation says and disable the signal for fixture loading

b1rger added a commit that referenced this issue Dec 5, 2024
Fixtures should contain all the data anyway, so the automatic creation
of the default uri should be skipped.

Closes: #1473
b1rger added a commit that referenced this issue Dec 6, 2024
Fixtures should contain all the data anyway, so the automatic creation
of the default uri should be skipped.

Closes: #1473
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants