Overriding form field classes / CSS attributes

26 views
Skip to first unread message

Alan Cleary

unread,
Apr 1, 2020, 4:05:02 PM4/1/20
to django-wiki
Hello,

I'm working on integrating django-wiki into a website that uses a different CSS library than bootstrap. I've been able to convert mostly everything to the other library by overriding templates, with the exception of the forms. These appear to have their classes assigned in the django-wiki Python code, which I would prefer not to modify. Is there a best practice for overriding the provided field attributes?

Much thanks,
Alan

Benjamin Balder Bach

unread,
Apr 1, 2020, 4:34:51 PM4/1/20
to djang...@googlegroups.com

Hi Alan,

django-wiki is unfortunately not perfect -- but there are a few patterns in place to avoid adding Bootstrap-specific CSS classes to form fields.

If you can contribute a PR that maintains a status quo for the default looks but makes your life easy when overriding the website, that would be most welcome!

Incidentally, we have been working on Bootstrap 4 support these days, so I think everyone can anticipate changes: https://github.com/django-wiki/django-wiki/pull/1035


Best,
Ben

--
You received this message because you are subscribed to the Google Groups "django-wiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-wiki...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-wiki/65e17cb6-0e0e-4d50-ab8f-d20f0d893dc0%40googlegroups.com.

Alan Cleary

unread,
Apr 1, 2020, 5:03:12 PM4/1/20
to django-wiki
Hey, Benjamin. Thanks for the quick reply.

there are a few patterns in place to avoid adding Bootstrap-specific CSS classes to form fields
I think I'm missing the reference here; what patterns are you referring to?

As far as PRs are concerned, I'll hold off until you get the Bootstrap 4 code merged. That should give me time to organize my thoughts ;)

On Wednesday, April 1, 2020 at 2:34:51 PM UTC-6, Benjamin Balder Bach wrote:

Hi Alan,

django-wiki is unfortunately not perfect -- but there are a few patterns in place to avoid adding Bootstrap-specific CSS classes to form fields.

If you can contribute a PR that maintains a status quo for the default looks but makes your life easy when overriding the website, that would be most welcome!

Incidentally, we have been working on Bootstrap 4 support these days, so I think everyone can anticipate changes: https://github.com/django-wiki/django-wiki/pull/1035


Best,
Ben


On 4/1/20 10:05 PM, Alan Cleary wrote:
Hello,

I'm working on integrating django-wiki into a website that uses a different CSS library than bootstrap. I've been able to convert mostly everything to the other library by overriding templates, with the exception of the forms. These appear to have their classes assigned in the django-wiki Python code, which I would prefer not to modify. Is there a best practice for overriding the provided field attributes?

Much thanks,
Alan
--
You received this message because you are subscribed to the Google Groups "django-wiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to djang...@googlegroups.com.

Benjamin Balder Bach

unread,
Apr 1, 2020, 5:19:02 PM4/1/20
to djang...@googlegroups.com

Hi Alan,

The Bootstrap 4 PR has been merged, but without any consequences to template/CSS override-friendliness.

Regarding existing (imperfect) patterns:

1) A custom form field in `wiki.forms` is used that refers to `settings.SelectWidgetBootstrap`

2) If you see other hard-coded (unconfigurable) references to Bootstrap CSS in Python, then a PR is defintiely desired


Best,
Ben

To unsubscribe from this group and stop receiving emails from it, send an email to django-wiki...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-wiki/71c5a954-099b-4b2e-a128-5f9798983106%40googlegroups.com.

Alan Cleary

unread,
Apr 1, 2020, 5:25:21 PM4/1/20
to django-wiki
Whoops! Didn't notice. Guess it's time to gather my thoughts...
Reply all
Reply to author
Forward
0 new messages