We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int or string? I haven't touch the source code for a while, so I need time to decide to choose which one.
The text was updated successfully, but these errors were encountered:
CharField 和 IntegerField(peewee 数据字段) 其实都是能工作的,看了下感觉应该是 CharField 比较合适吧,因为本身就是直接使用 '20151129' 这样的比较多,而且日期间的比较也是没有问题的。 照理来说好像要用 DateField,这样的话要稍微自定义下数据字段,不然每次都用 date 类型也是麻烦的,所以还是应该 '20151129' 这样的字符串传进去,调用时返回的应该也是 '20151129' 这样的。但这样的话,其实就是存的时候是 date 类型,出去进来都是 string 形式的,感觉就是多此一举了,不如直接使用 CharField。 其实我什么都不知道 >_<
Sorry, something went wrong.
比如说像这样的自定义字段
class ZhiDateField(Field): db_field = 'zhidate' def db_value(self, value): year, month, day = map(int, [value[:4], value[4:6], value[6:]]) return date(year, month, day) def python_value(self, value): return value.replace('-', '')
No branches or pull requests
int or string? I haven't touch the source code for a while, so I need time to decide to choose which one.
The text was updated successfully, but these errors were encountered: