Questions tagged [django-widget-tweaks]

django-widget-tweaks is the python package for Django to tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes are supported.

django-widget-tweaks is the python package for Django to tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes are supported. You can install it using

pip install django-widget-tweaks

You can find details in python software foundation https://pypi.org/project/django-widget-tweaks/ . For source code and other details please check github link.

54 questions
0
votes
2 answers

I can't get the selected student in widget tweaks render_field using CreateView

I am using the following code in views.py: class MatriculaCreateView(CreateView): template_name = "website/matricula.html" model = CursoPeriodoEstudante form_class = MatriculaMembroForm …
Alex Steeve
  • 3
  • 1
  • 5
0
votes
1 answer

Pass a string to javascript function from render_field tag in Django

I can pass a string value to javascript function onblur when using plain html tag as shown below: but when i try to do the same thing for…
Aseem
  • 5,848
  • 7
  • 45
  • 69
0
votes
1 answer

Django widget tweaks popover won't move with content

I'm using django widget tweaks to render a form field that is required. It all works fine, if the field is blank, I see a cute little popover that says field is required and all that, but if I scroll the page (the form is a little big), the popover…
DeA
  • 1,748
  • 3
  • 22
  • 41
0
votes
0 answers

cannot override the height of form input in django

{% csrf_token %}
{{ login_form.username|add_class:"form-control input_field"|attr:"placeholder:Username"}}
Nameless
  • 503
  • 3
  • 21
0
votes
1 answer

How to use MultipleChoiceField in django-widget-tweaks?

I have form with MultipleChoiceField field which has dynamic list for choices. With the help of this form users can select data and add them to database. Sometimes dynamic list can be empty []. So I want to show message in template when its empty…
0
votes
1 answer

Django formset not rendering with django-widget-tweaks

I am getting the error 'LoginForm' object has no attribute 'as_widget' whenever I use formset. I really do not know what is the problem as the forms renders properly with normal Django forms. I am trying to see what characteristics in the formset is…
Jam1
  • 629
  • 12
  • 25
0
votes
0 answers

How to keep name attribute in a template form using django widget tweaks?

I have created a form in a template in my Django project. Using Django widget tweaks, I customize my template form and now i wanted to add an attribute name = "Total" in my customized form. Html code: {% render_field form.amount…
sumanth
  • 751
  • 2
  • 15
  • 34
0
votes
2 answers

how to add css class to radio button in django template

I am trying to do the following with django widget tweaks: {{ form.gender.0.tag|attr:"class:radio_1" }} I get the error: 'SafeText' object has no attribute 'as_widget' What am I doing wrong?
Atma
  • 29,141
  • 56
  • 198
  • 299
-2
votes
1 answer

Django-widget-tweaks : ModuleNotFoundError: No module named 'widget_tweaks'

I am new to Django and also github CI/CD pipelines. I am working on a django project and I installed widget_tweaks via pip install django-widget-tweaks on the command prompt. The program and forms are working fine on the browser with no errors.…
AfriPwincess
  • 123
  • 1
  • 6
1 2 3
4