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
1
vote
1 answer

django-widget-tweaks using field.name in render_field

I am using django-widget-tweaks and its render_field. I have an odd situation and I wonder if there is a workaround or a different approach that I should use? I am using django and allauth (I am not using the social auth part yet). I have the…
7 Reeds
  • 2,419
  • 3
  • 32
  • 64
1
vote
1 answer

How to customize django signup form's helper texts with widget_tweaks?

I am trying to create a signup page and using django's default signup form while trying it. I have a problem with Password field's helper text because I cannot fix it. Here is my signup.html's body;
Hektor
  • 105
  • 3
  • 14
1
vote
2 answers

Invalid filter add_class using django-widget-tweaks

I am creating form view using django-widget-tweaks following this tutorial. When I tried to implement add_class filter, I got following error. Invalid filter: 'add_class' Does anyone know how to solve this error? html page {% extends…
Katsuya Obara
  • 903
  • 3
  • 14
  • 30
1
vote
1 answer

How to change django-autocomplete-light number of loaded objs by default?

By default, the ajax behavior in autocomplete queries 10 first objs of the list and by scrolling you would see further next 10 results. But the scrolling doesn't work smoothly so I need to actually see all the result on the list by default. (it's…
1
vote
1 answer

django templates: concatenate a string with an id inside a name input

I'm working with Django forms and widget_tweaks, and I need to create an input that has html like this I've tried : {% render_field modifier.designation…
Elroum
  • 327
  • 1
  • 3
  • 18
1
vote
0 answers

django-widget-tweaks with django custom tags

I am using django-widget-tweaks to render my django form fields. Now I need to show the return value of a custom django tag as the value of my render field. This is my template tag from forex_python.bitcoin import…
1
vote
1 answer

Django Widget Tweaks help text as placeholder

Is there any way to render help text as placeholder in Django Widget Tweaks. New to django widget tweaks.
Russell
  • 1,624
  • 5
  • 23
  • 43
1
vote
1 answer

Using stylesheets with django-widget-tweaks?

I'm struggling to understand how to use Django-Widget-Tweaks with a stylesheet. For example, here's my basic form with bunch of CSS classes pulled from my stylesheet - obviously not yet wired up with Django.
1
vote
1 answer

Correct way to implement django-widget-tweaks markup

I am trying to render a form using django-widget-tweaks to help with css and widget types. I performed the following steps: Install widget tweaks with pip3 in my venv successfully. Put 'widget_tweaks', in INSTALLED_APPS in settings.py. Put the…
Escher
  • 5,418
  • 12
  • 54
  • 101
1
vote
1 answer

Django custom form template and help text

I'm trying iterate over form fields, and not want to use default {{ field }} tag. I want customise each field in cycle. {% for field in wizard.form %}
0
votes
0 answers

Django and Docker: ModuleNotFoundError: No module named 'widget_tweaks'

I'm trying to use django-widget-tweaks in my web application (using Django and Docker), but it is not being recognized as an installed package. My DockerFile: # Pull base image FROM python:3.10.2-slim-bullseye # Set environment variables ENV…
Dhruv Erry
  • 161
  • 3
  • 8
0
votes
0 answers

How can I make a select list readonly in Django-widget-tweaks form?

With the code below, the control form does get the gray color that is related to non-editable form controls but it is however editable. I want a select list to show a value that the user can see but not edit. ` {% render_field…
Pablo J
  • 13
  • 4
0
votes
1 answer

What am I missing? Django form using Widget Tweaks

I get an AttributeError at /accounts/vendor/menuBuilder/category/add/ 'str' object has no attribute 'field' error in my html add form. The edit form works perfectly. And the add form is essentially a direct copy with the exception of the form…
Rico
  • 11
  • 4
0
votes
0 answers

How to add condition in django-widget-tweaks checkbox form (checked and disabled if attributes is existed)

I'm using django-widget-tweaks and dynamic-field to render my form. This form is use to create a new Line. User need to select Department (one line has one department) and Process (one line has many process) forms.py class LineForm(DynamicFormMixin,…
0
votes
1 answer

Append CSS class to form field

Once a field has been rendered {{ field|add_class }} how can you add additional classes? For example, let's say you want to build a variable and simply apply that. See the example below. If field.type = Select CSSSTYLES += 'form-select' If…