-
Notifications
You must be signed in to change notification settings - Fork 3
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
birger/512 uri #1463
base: main
Are you sure you want to change the base?
birger/512 uri #1463
Conversation
2946903
to
ed318dc
Compare
283842b
to
a7f35fd
Compare
a7f35fd
to
591406c
Compare
02a60bd
to
41d99dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data migration ✔️
Import via external URI ✔️
It seems like this PR removes the feature that allows user to link a Uri to a RootObject
Is that tabled for another PR or are we going to do away with manual linking of entities with URIs altogether and only rely on Merge and Import views to add an external Uri to an Object?
And likewise, it is possible to link Uri to any object, but at the moment this is also not supported via the webapp, right?
I was able to create Uris and link to non RootObject objects like Profession and a Relation via django shell
We should decide if it's worth having a clean up signal that clears the generic FK fields when the linked object is deleted. At the moment the object shows up as None but the content type lingers. In the database both generic FK fields hold the invalidated data.
And the "view" page of a Uri shows less information than the list view (related entity and entity type are missing). Not saying that it should be part of this PR but it is also a downgrade - as the related object (Root object ID) used to be part of the page.
Regarding apis_relations: Could we have Property Class URI
as a Uri object linked to a property?
I created a apis_relations properties like so:
And I tried to link the following entities with "located within" relation
It is possible that this error is nothing to do with this PR but I was not able to test this PR owing to this error - I was also not able to setup the "located within" property with subject and object types set to the RootObject. Got 'NoneType' object has no attribute '__subclasses__'
error.
a5fe1c6
to
2066511
Compare
thats the most important part ;)
good point. I had added
thats now possible |
2066511
to
5002721
Compare
Another point: default Uri created for an object should be deleted if the related object is deleted, we need a signal for this I think.
Not the point of this PR, moving it to a new issue once this is merged.
Confirmed by @b1rger This is an existing error, irrelevant to current PR
Tested, works ✔️
Works ✔️ |
The `Uri` should allow to point to any model instance, not only to models that inherit from `RootObject`. Therefore we introduce a GenericForeignKey. The migration copies the values of existing `root_object` pointers to the generic foreign key. The `root_object` field is then dropped from the model.
The Uri model now uses a generic foreign key instead of the direct foreign key to the RootObject. This commit updates all occurences of `root_object` to use the generic foreign key instead.
The `Uri` model now uses a generic foreign key instead of the direct foreign key to the `RootObject`. This commit updates all occurences of `root_object` to instead use the generic foreign key.
The `Uri` model now uses a generic foreign key instead of the direct foreign key to the `RootObject`. This commit updates all occurences of `root_object` to use the generic foreign key instead.
The `Uri` model now uses a generic foreign key instead of the direct foreign key to the `RootObject`. This commit updates all occurences of `root_object` to use the generic foreign key instead.
5002721
to
790eaed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything works as expected and the migrations are seamless.
Only one unresolved point about orphan URIs when the linked object is deleted. In the current implementation if a URI is linked to an object which is then deleted then the URI gets deleted too. I think we should preserve this behaviour at least for the default URI that's created using APIS_BASE_URI
or the default example.org
Other external URIs that are manually created and then linked to an object or added to the database via Import/Enrich features - I think should either be deleted like the default URIs as described above or have their generic FK fields set to None.
Closes: #512