Fix AlertAdminForm tags field and MultiChoiceArrayField issues in Dja… - #537
Conversation
|
why 171 files changed? |
bfe17ab to
21c3892
Compare
sorry i accidentally pushed all the files, the files that are not even changed were pushed. |
|
could be possible to do it without new tools, such as |
I initially attempted this using Django’s built-in widgets and MultipleChoiceField, but couldn’t get it working as expected for this field. While exploring alternatives, I tried DjangoSelect2 as a quick solution. I found out that DjangoSelect2 has a better UI interface and the user need not search for the tag manually in the list. I checked the method used by others... they used something called append which is not having a good UI interface when compared with Djangoselect2 , user need to manually find tags in the list and it is hard to work with when there is a list of long tags I agree that it’s better to avoid new dependencies here and I can refactor this to use Django’s native admin widgets instead. |
|
yes, the same widget already used for other fields (such as in the Config model) are preferred |
|
the |
I did use the command "black (file.py)" locally but I didn't understand why it is not reflecting on the file |
|
@Nivikiwi you should use the linters locally with the configurations files defined in the project, so running them with exactly the same command defined in the CONTRIBUTING.md file. Did you? |
|
|
which version of black do you have locally? |
black, 24.2.0 |
|
cc4432b to
317b74b
Compare
|
Try to install black |
|
@Nivikiwi in the CI it's already been updated, you have just to merged from the |
|
@Nivikiwi sorry, but why you changed a lot of files that should not been affected by this fix? |
6fc4490 to
c562f2a
Compare
I'm so sorry but i was just checking why my files are failing in the CI run test |
|
@Nivikiwi I tested it locally, the changes to the |
Thank you so much and sorry for the inconvenience |
Undo the changed to the other files (settings.py, docker-compose and _python.yml), not needed |
1a9533f to
d1d2ed2
Compare
|
Here we go, could you please undo also the changes to the |
yes |
257023f to
c0facee
Compare
c0facee to
efa98e3
Compare
efa98e3 to
b265f53
Compare
72e2306 to
5811876
Compare
|
the CI test is failing again and I don't understand where it is going wrong as I have formatted the forms.py file locally and checked locally if it it formatted and it says it has been formatted |
5811876 to
d6c0c07
Compare
d6c0c07 to
a52477b
Compare
|
I've fixed just applying |
I think so |
Thank you very much for your kind words. I’m really glad my explanations were helpful and that you were able to close the issue successfully. It was a pleasure to help, and I appreciate your thoughtful feedback. |





Description
This PR fixes the tags field behavior in the Django Admin for the Alert model.
Previously, the tags ArrayField was rendered as a free-text input or appeared empty due to incorrect form/widget configuration. Multiple attempts using custom widgets and SimpleArrayField caused admin page crashes and internal server errors.
1. Steps to Reproduce
Start the Django development server
Run the command : python manage.py runserver on virtual environment
Use the command : "docker restart buffalogs"
run the command on the project root (BuffaLogs)
Go to the admin panel
http://127.0.0.1:8001/admin/
Open any existing Alert object or create a new one
Observe the tags field:
Renders as a free-text input or
Renders empty with no selectable values or
Admin page crashes with HTTP 500 error
2. Evidence
Django Admin returned:
500 Internal Server Error
Tracebacks included errors such as:
TypeError: Field.init() got an unexpected keyword argument 'base_field'
3. Attempted Solutions
4. Changes
5. Results and Screenshots
Closes #497