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

2 - implicit/explicit declaration of fields in mapping #9

Open
IdrissaD opened this issue Apr 12, 2022 · 1 comment
Open

2 - implicit/explicit declaration of fields in mapping #9

IdrissaD opened this issue Apr 12, 2022 · 1 comment
Labels

Comments

@IdrissaD
Copy link
Contributor

IdrissaD commented Apr 12, 2022

Fields that have the exact same name in the API results and in Geotrek models are explicitely declared for now, in env.py:

"attachments" : {
        "author" : "author",
        "title" : "title",
        "legend" : "legend",
        "uuid" : "uuid",
    },

Implicit mapping would imply that if an API field has the same name than a model field, thus the API field value should be assigned to the model field. It could ease the code maintenance and automatically adapt to the creation of new fields in further Geotrek-admin/API v2 versions.

This functioning should be explained in code comments.

@IdrissaD
Copy link
Contributor Author

Selected solution: explicit mapping with a last elif condition allowing implicit mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant