brack3t / django-braces

Reusable, generic mixins for Django
http://django-braces.readthedocs.org/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
1.96k stars 218 forks source link

Cleaner approach to `HeaderMixin` #285

Open kennethlove opened 2 years ago

kennethlove commented 2 years ago

satisfying

This PR introduces a backwards-compatible change to the HeaderMixin. Our existing method works but feels kind of heavy-handed. This approach is more in-line with Django's design, IMO, and doesn't feel as blunt.

Unfortunately, it only works if render_to_response is ultimately called, so I had to leave in the old approach as well. Maybe we should split it up into a new mixin?

codecov-commenter commented 2 years ago

Codecov Report

Merging #285 (2f1a4ec) into main (df847c9) will increase coverage by 0.05%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
+ Coverage   97.72%   97.77%   +0.05%     
==========================================
  Files           8        8              
  Lines         484      495      +11     
  Branches       68       69       +1     
==========================================
+ Hits          473      484      +11     
  Misses          9        9              
  Partials        2        2              
Flag Coverage Δ
unittests 97.77% <100.00%> (+0.05%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
braces/views/_other.py 100.00% <100.00%> (ø)