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

Nouvelle API pour gérer les contenus #4767

Closed
wants to merge 6 commits into from

Conversation

artragis
Copy link
Member

@artragis artragis commented Oct 31, 2017

le but de cette PR est de créer une API pour gérer les tutos (pour l'instant, on ne joue pas pour l'affichage des publications).

Cela peut être vu comme le pendant backend de la nouvelle interface de rédaction qui est en cours de maquettage.

Je vais faire deux endpoints ou groupe de endpoints :

  • Gestion des chapitre/extraits/parties.
  • Gestion des métadata (titre, licence, catégorie...)

Ça serait bien que j'ai un petit descriptif de ce que je dois mettre dans ces endpoints pour correspondre aux besoins du frontend

QA

  • Review
  • si vous voyez des cas qui ne sont pas testés dans test_api.py dites-le je les ajoute.

@motet-a motet-a added C-API Concerne une API du site C-Back Concerne le back-end Django labels Oct 31, 2017
@artragis artragis force-pushed the tutorial_api branch 2 times, most recently from 2d369e4 to 98ea607 Compare October 31, 2017 13:20
@zestedesavoir zestedesavoir deleted a comment from coveralls Oct 31, 2017
@artragis artragis force-pushed the tutorial_api branch 2 times, most recently from 91802ad to 2597467 Compare October 31, 2017 13:49
@zestedesavoir zestedesavoir deleted a comment from coveralls Oct 31, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Oct 31, 2017
@artragis artragis changed the title Nouvelle API pour gérer les contenus [WIP]Nouvelle API pour gérer les contenus Oct 31, 2017
@motet-a motet-a changed the title [WIP]Nouvelle API pour gérer les contenus [WIP] Nouvelle API pour gérer les contenus Nov 3, 2017
zds/tutorialv2/mixins.py Outdated Show resolved Hide resolved
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 7, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 9, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 9, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 10, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 10, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 10, 2017
@artragis artragis force-pushed the tutorial_api branch 2 times, most recently from 6bdccda to c0ff68e Compare November 13, 2017 13:03
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 13, 2017
@zestedesavoir zestedesavoir deleted a comment from coveralls Nov 13, 2017
@artragis artragis force-pushed the tutorial_api branch 3 times, most recently from a86a193 to fb721cf Compare November 22, 2017 10:43
@artragis artragis force-pushed the tutorial_api branch 2 times, most recently from 15d8b99 to 648f50c Compare September 5, 2018 16:10
@artragis artragis force-pushed the tutorial_api branch 3 times, most recently from 4aced15 to 5b50dca Compare December 28, 2018 11:59
@zestedesavoir zestedesavoir deleted a comment from coveralls Jun 5, 2019
@zestedesavoir zestedesavoir deleted a comment from coveralls Jun 5, 2019
@zestedesavoir zestedesavoir deleted a comment from coveralls Jun 5, 2019
@artragis
Copy link
Member Author

Quelqu'un pour faire la QA svp?

@artragis artragis added the Bloquant Ticket qui doit être traité avant la prochaine mise à jour label Aug 19, 2019
@Situphen
Copy link
Member

Je l'ai déployée sur la bêta mais j'ai 2 erreurs 500 sur /api.

[ERROR] -- 2019-08-20 07:03:13,216 -- django.request : Internal Server Error: /api/
Traceback (most recent call last):
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 495, in dispatch
    response = self.handle_exception(exc)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 455, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 492, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework_swagger/views.py", line 32, in get
    schema = generator.get_schema(request=request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/generators.py", line 281, in get_schema
    links = self.get_links(None if public else request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/generators.py", line 317, in get_links
    if not self.has_view_permissions(path, method, view):
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/generators.py", line 390, in has_view_permissions
    view.check_permissions(view.request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 334, in check_permissions
    if not permission.has_permission(request, self):
  File "/opt/zds/app/zds/member/api/permissions.py", line 46, in has_permission
    view.get_object())
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/generics.py", line 85, in get_object
    queryset = self.filter_queryset(self.get_queryset())
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/generics.py", line 68, in get_queryset
    % self.__class__.__name__
AssertionError: 'ExportView' should either include a `queryset` attribute, or override the `get_queryset()` method.
[ERROR] -- 2019-08-20 13:51:54,100 -- django.request : Internal Server Error: /api/
Traceback (most recent call last):
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 495, in dispatch
    response = self.handle_exception(exc)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 455, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/views.py", line 492, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework_swagger/views.py", line 32, in get
    schema = generator.get_schema(request=request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/generators.py", line 281, in get_schema
    links = self.get_links(None if public else request)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/generators.py", line 319, in get_links
    link = view.schema.get_link(path, method, base_url=self.url)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/inspectors.py", line 217, in get_link
    fields += self.get_serializer_fields(path, method)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/schemas/inspectors.py", line 360, in get_serializer_fields
    for field in serializer.fields.values():
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/serializers.py", line 364, in fields
    self._fields[key] = value
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/utils/serializer_helpers.py", line 147, in __setitem__
    field.bind(field_name=key, parent=self.serializer)
  File "/opt/zds/virtualenv/lib/python3.5/site-packages/rest_framework/fields.py", line 378, in bind
    (field_name, self.__class__.__name__, parent.__class__.__name__)
AssertionError: It is redundant to specify `source='extracts'` on field 'ListField' in serializer 'ChildrenListModifySerializer', because it is the same as the field name. Remove the `source` keyword argument.

@artragis artragis self-assigned this Sep 9, 2019
artragis and others added 5 commits September 12, 2019 22:19
Cette API permet d'ajouter, trier, modifier des extraits et des espaces hiérarchiques.
Elle est un préambule au travail de génération d'un nouvel éditeur de tutoriel sur le site.
En effet en corrigeant les problèmes des sérializers je me suis rendu compte
que cela est nécessaire car ces derniers demandent à envoyer les pk des catégories
pour créer/supprimer le contenu.

Notons que le même problème se posera pour les licences mais semble pouvoir être corrigé rapidement.
@artragis artragis removed the Bloquant Ticket qui doit être traité avant la prochaine mise à jour label Sep 2, 2020
@artragis artragis closed this Apr 25, 2021
@artragis artragis deleted the tutorial_api branch April 25, 2021 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API Concerne une API du site C-Back Concerne le back-end Django
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants