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

Add option to automatically populate field placeholders #935

Closed

Conversation

smithdc1
Copy link
Member

@smithdc1 smithdc1 commented Nov 2, 2019

This is my attempt to fix #786

Now... Whilst I've learnt a fair amount looking at this and it's been very enjoyable I'm not entirely sure it should be merged.

I understand that we should show restraint when adding new features, and as described in the issue there is a DRY way of doing this outside of crispy-forms. I guess at least this one shouldn't break anything.

Appreciate your thoughts, both on the topic of implementing this issue, and some feedback on my code would be nice as well (whatever the outcome).

Below is an image of the placeholder matching the label.
Capture
.

@codecov-io
Copy link

codecov-io commented Nov 2, 2019

Codecov Report

Merging #935 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #935      +/-   ##
==========================================
+ Coverage    95.1%   95.12%   +0.02%     
==========================================
  Files          24       24              
  Lines        2756     2771      +15     
  Branches      252      254       +2     
==========================================
+ Hits         2621     2636      +15     
  Misses         90       90              
  Partials       45       45
Impacted Files Coverage Δ
crispy_forms/templatetags/crispy_forms_tags.py 97.45% <ø> (ø) ⬆️
crispy_forms/tests/test_form_helper.py 97.28% <100%> (+0.03%) ⬆️
crispy_forms/templatetags/crispy_forms_field.py 86.6% <100%> (+0.75%) ⬆️
crispy_forms/helper.py 90.82% <100%> (+0.04%) ⬆️

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 1972126...8be0b39. Read the comment docs.

Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @smithdc1.

The code you have here is fine for this, but no, it's not something I think we should add.
Essentially, it's always much better to do this kind of thing explicitly. The linked example from the issue seems entirely correct to me. (Folks are welcome to add a method to their form classes, as a base class or mixin in they want it DRY™, to do this for them.)

Gonna close on that basis...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to automatically populate field placeholders
3 participants