未知
bw-attributes的Python项目详细描述
bw_attributes是一个允许将任意属性与django模型关联的库。
用法:
import bw_attributes bw_attributes.register(MyModel) my_object = MyModel.objects.all()[0] my_object.attributes['a number'] = 3e4 my_object.attributes['a string'] = "An example" my_object.attributes['a boolean'] = True # Retrieval follows the same dictionary-type interface. my_object.attributes['a string'] > u'An example'
有关更多示例,请参见测试。支持以下类型:
- 整数
- 浮点数
- 字符串
- 日期(datetime.date)
- 时间(datetime.time)
- 日期时间(datetime.datetime)
- 布尔人
运行测试,安装到现有的Django项目(添加到IntualDeIsAppApple)中,并运行:
./manage.py test --settings=bw_attributes.tests.settings