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

Select other kind of widget #13

Open
koalalorenzo opened this issue Jun 16, 2014 · 2 comments
Open

Select other kind of widget #13

koalalorenzo opened this issue Jun 16, 2014 · 2 comments

Comments

@koalalorenzo
Copy link

Is there any way to render a field with a different widget type?
I need to render a select input into a text input.

In the django Form class, for specific reason, I can't set widget=forms.TextInput, but I should be able to do it in a smart way like that:

{% render_field form.start_date class+="form-control" type="text" %}

But what I got is a HTML tag instead.

@kmike
Copy link
Collaborator

kmike commented Jun 16, 2014

That's interesting. It seems it is possible to implement, but it is not implemented now. Check https://github.com/kmike/django-widget-tweaks/blob/master/widget_tweaks/templatetags/widget_tweaks.py#L14 - to inplement it one need to return different widget class in inner as_widget function. I'm open to pull requests for such feature.

@koalalorenzo
Copy link
Author

Amazing 👍

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

No branches or pull requests

2 participants