Skip to content
Snippets Groups Projects
  1. Jul 02, 2024
  2. May 22, 2024
  3. Apr 09, 2024
  4. Jan 26, 2024
  5. Apr 05, 2023
  6. Apr 03, 2023
  7. Mar 28, 2022
    • Konrad Mohrfeldt's avatar
      refactor: move subroute filtering into viewset mixin · a0e800d9
      Konrad Mohrfeldt authored
      Most of the queryset filtering for subroutes formerly implemented
      through custom get_queryset methods can happen semi-automated through a
      mixin, making the behaviour re-usable and allowing us strip a lot of
      additional logic for retrieving objects.
      
      The use of the viewset get_object method also allows us to implement
      object access with permission classes in the future, and should make a
      whole lot of other code obselete.
      
      This change is primarily motivated by the fact that documentation of the
      API will become a lot easier if the subroutes don’t impose arbitrary
      restrictions on the specific subpath under which an operation is
      allowed. For instance updating a schedule should be possible through
      either /schedules/<pk>/ or
      /shows/<show_pk>/schedules/<schedule_pk>/ as long as all the necessary
      data is present in the request body.
      a0e800d9
    • Konrad Mohrfeldt's avatar
      refactor: implement consistent pk/slug retrieval for shows · c650f609
      Konrad Mohrfeldt authored
      The show retrieve method allowed shows to be identified through the slug
      or the id. This is handy, but was restricted to the retrieve and did not
      apply to the update nor delete methods. The proper way to implement this
      kind of behaviour is through overriding get_object so that route
      identifiers are handled consistently.
      c650f609
  8. Mar 22, 2022
    • Konrad Mohrfeldt's avatar
      refactor: move subroute filtering into viewset mixin · 3507bbdb
      Konrad Mohrfeldt authored
      Most of the queryset filtering for subroutes formerly implemented
      through custom get_queryset methods can happen semi-automated through a
      mixin, making the behaviour re-usable and allowing us strip a lot of
      additional logic for retrieving objects.
      
      The use of the viewset get_object method also allows us to implement
      object access with permission classes in the future, and should make a
      whole lot of other code obselete.
      
      This change is primarily motivated by the fact that documentation of the
      API will become a lot easier if the subroutes don’t impose arbitrary
      restrictions on the specific subpath under which an operation is
      allowed. For instance updating a schedule should be possible through
      either /schedules/<pk>/ or
      /shows/<show_pk>/schedules/<schedule_pk>/ as long as all the necessary
      data is present in the request body.
      3507bbdb
    • Konrad Mohrfeldt's avatar
      refactor: implement consistent pk/slug retrieval for shows · f7926bd9
      Konrad Mohrfeldt authored
      The show retrieve method allowed shows to be identified through the slug
      or the id. This is handy, but was restricted to the retrieve and did not
      apply to the update nor delete methods. The proper way to implement this
      kind of behaviour is through overriding get_object so that route
      identifiers are handled consistently.
      f7926bd9
  9. Mar 17, 2022
    • Konrad Mohrfeldt's avatar
      fix: fix audio_url generation for notes · 24f6f06d
      Konrad Mohrfeldt authored
      There were some problems during audio_url generation for notes:
      
      1. the cba_id was never part of the Note serializer so getting
         values from the validated data needed to fail.
      2. the get_audio_url utililty function returned None if
         no cba_id was provided if a the CBA_API_KEY was missing,
         but None but the respective model field is not nullable on the note.
      3. Request or JSON decoder errors would bubble unhandled, even though
         audio_url generation seems to be optional and should not necessarily
         interfere with note creation.
      24f6f06d
  10. Mar 15, 2022
  11. Mar 14, 2022
    • Ernesto Rico Schmidt's avatar
      Format source with Black · 0ace09e7
      Ernesto Rico Schmidt authored
      0ace09e7
    • Ernesto Rico Schmidt's avatar
      Refactor and Clean-up Viewsets · 5c34d059
      Ernesto Rico Schmidt authored
      - Reorder the code inside the methods to fail fast on autorization,
      - Replace `int_or_none` with a more generic solution, and move to utils,
      - Add `get_values` and move `pk_and_slug` as `get_pk_and_slug` into utils,
      - Replace calls to static methos in models local queries,
      - Return meaningful status code while creating and updating resources,
      - Return `409` when creating or updating a schedule produces a conflict.
      5c34d059
  12. Feb 21, 2022
  13. Feb 14, 2022
  14. Jan 24, 2022
  15. Nov 24, 2020
  16. Feb 18, 2018
  17. Oct 23, 2017
  18. Apr 07, 2017
  19. Sep 16, 2016
  20. May 27, 2016
  21. Jan 06, 2016
  22. Jul 21, 2014
  23. Feb 07, 2014
  24. Apr 12, 2013
Loading