marksweb / django-bleach

Bleach is a Python module that takes any HTML input, and returns valid, sanitised HTML that contains only an allowed subset of HTML tags, attributes and styles. django-bleach is a Django app that makes using bleach extremely easy.
MIT License
148 stars 23 forks source link

models.BleachField's form field set to forms.BleachField #19

Closed Alirezaja1384 closed 3 years ago

Alirezaja1384 commented 3 years ago

Description

Describe: models.BleachField's form field automtically set to forms.BleachField in ModelForm

References

Fix #13

Checklist

codecov[bot] commented 3 years ago

Codecov Report

Merging #19 (8a9d286) into master (70f4e21) will decrease coverage by 1.25%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #19      +/-   ##
===========================================
- Coverage   100.00%   98.75%   -1.25%     
===========================================
  Files            2        3       +1     
  Lines           49       80      +31     
  Branches         8       16       +8     
===========================================
+ Hits            49       79      +30     
- Partials         0        1       +1     
Impacted Files Coverage Δ
forms.py 97.82% <0.00%> (-2.18%) :arrow_down:
models.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 70f4e21...8a9d286. Read the comment docs.

marksweb commented 3 years ago

@Alirezaja1384 This needs tests to ensure a model form uses the correct field.

Likely best done by updating the form tests to use the bleach form and a new ModelForm with a model in the test project.

Alirezaja1384 commented 3 years ago

Ok, I'll do both soon. Thanks for your review.

Alirezaja1384 commented 3 years ago

I have added another test for models.py and its coverage is now 100%. But I have no idea about forms.py. Coverage report says line 35->37 are missed, but there are test_default_widget and test_custom_widget tests in test_settings.py.

marksweb commented 3 years ago

@Alirezaja1384 thank you.

The coverage from the github action isn't ran against all files in the app. I raised #20 so that isn't forgotten about.

Essentially I need to find some time to look over things 😂👍