Изменение свойства django-autocomplete-light html

1st How do i change a default html property on django-autocomplete-light?

2nd How does django renders the html elements from a form widget?

Привет! Я использую django-autocomplete-light v3.

1st I will show you how to understand my problem
2nd I'going to ask you for any help

Вы хотите попробовать django-autocomplete-light меньше чем за минуту и помочь мне?

You may follow the steps from here: https://django-autocomplete-light.readthedocs.io/en/master/install.html

Or just:
pip install django-autocomplete-light

Then, to let Django find the static files we need by adding to INSTALLED_APPS, before
django.contrib.admin and grappelli if present:

'dal',
'dal_select2',
# 'grappelli',
'django.contrib.admin',

Install the demo project
Install the demo project in a temporary virtualenv for testing purpose:

cd /tmp
virtualenv -p python3 dal_env
source dal_env/bin/activate
pip install django
pip install -e git+https://github.com/yourlabs/django-autocomplete-light.git#egg=django-autocomplete-light
cd dal_env/src/django-autocomplete-light/test_project/
pip install -r requirements.txt
./manage.py migrate
./manage.py createsuperuser
./manage.py runserver
# go to http://localhost:8000/admin/ and login

Сейчас вы в состоянии помочь!!!

1.1 Log in to your admin panel
1.2 scroll until you see "SELECT2_ONE_TO_ONE" and click
1.3 Add a new Tmodel clicking in the 'plus' button from the right
1. 4 Go to the Inspection mode on you Browser (ctrl+shift+i)and click on any select field there



i don't have enough reputation to post an image, but you can se it in this link here: https://github.com/yourlabs/django-autocomplete-light/issues/850#issuecomment-370982681

Сейчас вы можете увидеть нечто похожее на то, что показано на изображении.

What i'm trying to do is to change the style property of the second above the input of the select and that is what a want you to help me with.

Я хочу изменить файл, где написано "style='width:434px'" на "style='width:100%'", но не могу найти его нигде, потому что не знаю, как django отображает html-элементы или откуда они берутся.

У меня также есть django-autocomplite-light в личном проекте, которым я не стал делиться здесь, чтобы избежать больших объяснений. :)

2 I would be very thankful for any help!

Чтобы решить эту проблему, я просто изменил свойство min-width основного класса элемента следующим образом:

.select2-container {
    min-width: 18.5em !important;
}

Не то, что я искал, но...

Вернуться на верх