首页 > 代码库 > 遍历修改django bootstrap form 为 django bootstrap3
遍历修改django bootstrap form 为 django bootstrap3
#!/usr/bin/env python # encoding: utf-8 import re import os fname = ‘‘ bt_pattern = re.compile(r‘{% load bootstrap .*‘) field_pattern = re.compile(r‘(\s*){{\s*(form\.\w+)\|\s*bootstrap_horizontal\s*}} *‘) def bs2bs3(fn): with open(fn) as f: content = f.read() content = bt_pattern.sub(r‘{% load bootstrap3 %}‘, content) content = field_pattern.sub(r‘\1{% bootstrap_field \2 layout="horizontal" %}‘, content) with open(fn, ‘w‘) as f: f.write(content) def walk_dir(dirname): for root, dirs, files in os.walk(dirname, topdown=False): for name in files: fname = os.path.join(root, name) bs2bs3(fname)
遍历修改django bootstrap form 为 django bootstrap3
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。