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

Handle hidden field #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Handle hidden field #42

wants to merge 1 commit into from

Conversation

Nivl
Copy link

@Nivl Nivl commented Nov 24, 2013

Currently hidden fields have their label displayed. This pull request will only display the field and not the label of an hidden element.


@register.filter
def is_hidden(field):
return field.field.widget.__class__.__name__.lower() == "hiddeninput"
Copy link
Author

Choose a reason for hiding this comment

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

Replace this line with "isinstance(field.field.widget, forms.HiddenInput)" if #38 is merged.

@tzangms
Copy link
Owner

tzangms commented Dec 5, 2013

@Nivl which version of Django are you using?

@Nivl
Copy link
Author

Nivl commented Dec 5, 2013

@tzangms 1.6 Why? There's something wrong with the code?

@tzangms
Copy link
Owner

tzangms commented Dec 5, 2013

@Nivl

Nope, I just try to add a hidden field with this line below, but I didn't see any label appear

hidden_field = forms.CharField(widget=forms.HiddenInput)

is something like this?

@Nivl
Copy link
Author

Nivl commented Dec 5, 2013

Actually I only had the issue using modelformset_factory (sorry, I should have made that clear). Django is adding the pk field in the form as an hidden input, but for an unknown reason it displays the label.

@tzangms
Copy link
Owner

tzangms commented Dec 5, 2013

Got it, I will test that, and I should improve the example project for testing modelformset_factory

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.

2 participants