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

DatasetM2MField #4

Open
thclark opened this issue May 14, 2021 · 0 comments
Open

DatasetM2MField #4

thclark opened this issue May 14, 2021 · 0 comments
Labels
backend Related to the back end feature A new feature of the app

Comments

@thclark
Copy link
Contributor

thclark commented May 14, 2021

Feature request

Use Case

Using the AbstractSynchronisedDatastore, it's possible to create datasets simply by querying models that inherit from that.

But what about when we want to create a dataset by virtue of relating to one of those stores?

We'd need to store an M2M relation (which *Datastore objects are in the dataset) AND some JSON data (what tags etc are on the dataset, what's the dataset called, etc).

Current state

Currently, we're manually using an M2M relation then botching the dataset metadata together.

Proposed solution 1

To store both an m2m and a json dataset requires two tightly-coupled fields on the model.

It would be good to do that in one field to make the declaration of such a relation elegant in django; we can do so by dynamically adding a field within a field definition, like shown here:

https://blog.elsdoerfer.name/2008/01/08/fuzzydates-or-one-django-model-field-multiple-database-columns/

Proposed solution 2

Create an AbstractDatasetRelation model that serves as a through-model for the M2M relation but has a manager attached that allows mangement of dataset metadata. Not quite sure if this'll work but might be interesting.

@thclark thclark added backend Related to the back end feature A new feature of the app labels May 14, 2021
@thclark thclark removed this from Octue Board Dec 1, 2021
@thclark thclark moved this to Priority 1 (Low) in Octue Board Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to the back end feature A new feature of the app
Projects
Status: Priority 1 (Low)
Development

No branches or pull requests

1 participant