-
Notifications
You must be signed in to change notification settings - Fork 77
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
Touristicevent organizers in many to many #3587 #3864
Touristicevent organizers in many to many #3587 #3864
Conversation
Passing run #8105 ↗︎
Details:
Review all test suite changes for PR #3864 ↗︎ |
1d98523
to
cbf2bf3
Compare
geotrek/api/v2/serializers.py
Outdated
organizer_id = serializers.PrimaryKeyRelatedField( | ||
read_only=True | ||
) | ||
organizer = serializers.SerializerMethodField(source="organizers") |
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.
Si organizer est une liste, nomme le au pluriel
organizer = serializers.SerializerMethodField(source="organizers") | |
organizers = serializers.SerializerMethodField() |
Par contre, quid de la retrocompat ?
l'aggregateur utilise l'api v2, i lfaut qu'on puisse importer les données avec
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.
Merci pour les retours.
J'avais garder le "organizer" au singulier justement pour la rétrocompatibilité. Mais vu que le champs en maintenant en M2M, de toute façon il va falloir revoir pleins de choses.
Je me proposais de revoir aussi la partie parser, pour assurer la retrocompat
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.
Oui, on utilise aussi la propriété "organizer" dans Geotrek-rando-v3, c'est pour ça qu'on ne l'avait pas renommé.
Mais de mémoire, on peut faire un synonyme pour gérer la transition et que "organizers" ou "organizer" fonctionne ?
geotrek/api/v2/serializers.py
Outdated
read_only=True | ||
) | ||
organizer = serializers.SerializerMethodField(source="organizers") | ||
organizer_id = serializers.SerializerMethodField(source="organizers") |
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.
idem pour le nom (source="organizers" n'est pas necessaire pour un serializers.SerializerMethodField)
geotrek/api/v2/serializers.py
Outdated
return ", ".join( | ||
map(lambda org: org.label, organizers) | ||
) | ||
return None |
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.
en temps normal j'aurai suggéré d'utiliser .values_list(), mais pour que le prefetch fonctionne il vaut mieux 👍🏼
def get_organizer(self, obj):
return ", ".join(
map(lambda org: org.label, obj.organizers.all())
)
attention à if obj.organizers:
, c'est un manager de M2M pas une liste, c'est tjrs == True
geotrek/api/v2/serializers.py
Outdated
return None | ||
|
||
def get_organizer_id(self, obj): | ||
return [org.id for org in obj.organizers.get_queryset()] |
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.
return [org.id for org in obj.organizers.get_queryset()] | |
return [org.id for org in obj.organizers.all()] |
msgstr "" | ||
|
||
#: geotrek/tourism/tests/test_functional.py:131 | ||
#: geotrek/tourism/tests/test_functional.py:277 |
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.
pour les trads, il faut mettre à jour tous les fichiers de toutes les langues, (sans -l en) et en utilisant l'indication pour ne pas rajoter tous ces commentaires (--no-location)
https://github.com/GeotrekCE/Geotrek-admin/blob/master/Makefile#L41
geotrek/tourism/serializers.py
Outdated
return ", ".join( | ||
map(lambda org: org.label, organizers) | ||
) | ||
return None |
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.
meme remarques que dans les serializers API v2 pour le nom / contenu
dec5b6d
to
d2b3b69
Compare
c0a7ab3
to
5e2ff46
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3864 +/- ##
=======================================
Coverage 98.35% 98.35%
=======================================
Files 294 294
Lines 22285 22309 +24
=======================================
+ Hits 21918 21942 +24
Misses 367 367 ☔ View full report in Codecov by Sentry. |
5e2ff46
to
39a2b9f
Compare
J'ai corrigé les derniers tests sur les parsers |
Tout est bon sur cette PR, sauf les fichiers de langues. |
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.
I think there is a problem with your traslation files.
https://github.com/GeotrekCE/Geotrek-admin/pull/3864/files#diff-fc6029e51be9d381ebe39b2b526f0a10f7cb10fd0ed1800e0a79048e8dbe58d3 is too big.
I supose you create a local venv folder that is parsed by makemessages
Yes I had a venv. I re run |
Your changes in geotrek/locales shoud be reverted |
f88bc2b
to
201f9f7
Compare
replaced by #3965 |
Description
Transform the field
organizer
to a many to many field nameorganizers
The PR keep retrocompatibilty on the API : the attribute
organizer
now return a concatened string of theorganizers
labels. We still can filter on organisms with theorganism
parameterHowever the field
organizer_id
is now namedorganizers_id
and return a list ofid
organismRelated Issue
#3587
Checklist