-
Notifications
You must be signed in to change notification settings - Fork 0
added GET request for rating of projects #264
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
Conversation
rate_projects/views.py
Outdated
| program_id = self.kwargs.get('program_id') | ||
|
|
||
|
|
||
| criterias = Criteria.objects.prefetch_related('partner_program').filter(partner_program_id=program_id) |
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.
вот тут вопрос. у меня несколько запросов к разным таблицам. надо ли мне сувать их в менеджеры данных таблиц? не факт, что они будут переиспользоваться
| criteria_serializer = CriteriaSerializer(data=criterias, many=True) | ||
| scores_serializer = ProjectScoreSerializer(data=[scores], many=True)# idk why it needs [], but don't fix what ain't broken | ||
|
|
||
| criteria_serializer.is_valid() |
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.
и тот же самый вопрос с сериалайзерами. я их так сделал, потому что не хочу переусложнять один единственный сериалайзер. так проще и понятнее. но нормально ли я сделал, что прям несколько отдельных вызываю по ходу кода? куда их можно вынести?
rate_projects/views.py
Outdated
|
|
||
|
|
||
| criterias = Criteria.objects.prefetch_related('partner_program').filter(partner_program_id=program_id) | ||
| scores = ( |
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.
если что, такие странные запросы обусловлены тем, что я использовал Django Silk (утилиту для отслеживания SQL запросов), и пытался ей угодить
9609b33 to
cbd1567
Compare
в комментариях укажу, где вопрос