django bootstrap3

9 篇文章 0 订阅
1 篇文章 0 订阅

django bootstrap3

使用其实很方便。

1. install bootstrap3

pip install django-bootstrap3

try import bootstrap3

2. Add to INSTALLED_APPS in your settings.py:

'bootstrap3',

3. Load the bootstrap3 library and use the bootstrap_* tags:

{# Load the tag library #}
{% load bootstrap3 %}

{# Load CSS and JavaScript #}
{% bootstrap_css %}
{% bootstrap_javascript %}

{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}

{# Display a form #}
<form action="/url/to/submit/" method="post" class="form">
  {% csrf_token %}
  {% bootstrap_form form %}
  {% buttons %}
    <button type="submit" class="btn btn-primary">
      {% bootstrap_icon "star" %} Submit
    </button>
  {% endbuttons %}
</form>

{# Read the documentation for more information #}

表单还是具体的表单,用点bootstrap* 的东西修饰一下就行了。还是挺方便的。

值得注意的是bootstrap 他默认是屏幕自适应的,需要用div 标签限制一下。

<div style="width:200px">

完整的项目可以参考我的gitlab

git@github.com:gqdw/bootstrap_test.git

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值