I'm writing a web app with Flask and I've made a CSS template that I'm happy with. I want to use the wtf.quick_form()
feature from Bootstrap, but I can't load Bootstrap without overriding my own CSS. All I want to do is load the quick_form()
feature. What's the best way to go about this?
Asked
Active
Viewed 5,088 times
0

Siguza
- 21,155
- 6
- 52
- 89
1 Answers
3
Well, there's a previous question that covers the topic of using custom CSS, but, honestly, if you're only wanting to use Bootstrap for quick_form()
, you don't have to go through all of that.
Let's say you have your base.html file:
<!DOCTYPE html>
{% extends "bootstrap/base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% block styles %}
{{ super() }}
<link rel="stylesheet"
href="{{url_for('static', filename='style.css')}}">
{% endblock %}
It's suggested elsewhere that you load your 'style.css'
file after you load the 'bootstrap.css'
file, but you can get away with a simple link rel
to 'style'.css'
if all you want to do is load quick.form()
. Just make sure you remember to import "bootstrap/wtf.html"
in your base template or in the template file that you want to use quick_form()
.

Community
- 1
- 1

JoshieSimmons
- 2,721
- 2
- 14
- 23
-
I followed your example but when I tried to render a form in my template, I got a Jinja Build Error -- it didn't recognize `wtf.quick_form()`. – Jun 21 '14 at 02:25
-
1Did you make sure to import "bootstrap/wtf.html" OR make sure that the template page that you're editing extends your base page file? Also, post the specific error so we have more to work with. – JoshieSimmons Jun 21 '14 at 02:28
-
I went back and saw that I hadn't extended my template. I did that and now I've got quick_forms()! Thanks! – Jun 21 '14 at 02:34