class Question(models.Model):
question_text = models.CharField(max_length=200)
怎么看models有哪些属性??是不是很弱的问题,我知道看源码可以,我是想看看有没有更好的通常的方式,谢谢!
models.CharField(max_length=200)
有哪些字段和后面的参数
1
gamexg 2015-05-14 12:22:02 +08:00 via Android
Dj. 文档
|
2
Septembers 2015-05-14 12:23:34 +08:00 1
我 只 想 问 为 什 么 不 看 文 档?
see https://docs.djangoproject.com/en/1.8/topics/db/models/ see https://docs.djangoproject.com/en/1.8/ref/models/fields/ |
3
codegeek 2015-05-14 12:25:16 +08:00
read the fuck manuel
|
4
imlonghao 2015-05-14 12:31:01 +08:00 via Android
Please take a look at the fucking document.
|
5
braineo 2015-05-14 12:39:06 +08:00
UTFG
|
6
Septembers 2015-05-14 12:43:04 +08:00
@braineo UTFG是什么鬼?是什么的缩写?
|
7
Anybfans 2015-05-14 12:44:12 +08:00
下个IDE。。。。自动提示
|
8
est 2015-05-14 12:45:30 +08:00 1
@Septembers Uninstall the fucking game
|
9
Itanium 2015-05-14 12:52:43 +08:00 1
$ python manage shell
from django.db import models dir(models) 只是看属性 |
10
braineo 2015-05-14 13:02:44 +08:00 1
|
11
sinux 2015-05-14 13:17:30 +08:00
昨天在stack上回答这个问题....
|
12
tanteng OP @Septembers 我就知道有人这么回答
|
14
tanteng OP @Itanium
>>> from django.db import models >>> dir(models) ['Aggregate', 'AutoField', 'Avg', 'BLANK_CHOICE_DASH', 'BigIntegerField', 'Binar yField', 'BooleanField', 'CASCADE', 'Case', 'CharField', 'CommaSeparatedIntegerF ield', 'Count', 'DO_NOTHING', 'DateField', 'DateTimeField', 'DecimalField', 'Dur ationField', 'EmailField', 'Empty', 'Expression', 'ExpressionWrapper', 'F', 'Fie ld', 'FieldDoesNotExist', 'FileField', 'FilePathField', 'FloatField', 'ForeignKe y', 'ForeignObject', 'Func', 'GenericIPAddressField', 'IPAddressField', 'ImageFi eld', 'ImproperlyConfigured', 'IntegerField', 'Lookup', 'Manager', 'ManyToManyFi eld', 'ManyToManyRel', 'ManyToOneRel', 'Max', 'Min', 'Model', 'NOT_PROVIDED', 'N ullBooleanField', 'ObjectDoesNotExist', 'OneToOneField', 'OneToOneRel', 'OrderWr t', 'PROTECT', 'PositiveIntegerField', 'PositiveSmallIntegerField', 'Prefetch', 'ProtectedError', 'Q', 'QuerySet', 'RemovedInDjango19Warning', 'SET', 'SET_DEFAU LT', 'SET_NULL', 'SlugField', 'SmallIntegerField', 'StdDev', 'SubfieldBase', 'Su m', 'TextField', 'TimeField', 'Transform', 'URLField', 'UUIDField', 'Value', 'Va riance', 'When', '__builtins__', '__cached__', '__doc__', '__file__', '__loader_ _', '__name__', '__package__', '__path__', '__spec__', 'aggregates', 'base', 'co nstants', 'deletion', 'expressions', 'fields', 'get_app', 'get_app_path', 'get_a pp_paths', 'get_apps', 'get_model', 'get_models', 'lookups', 'manager', 'options ', 'permalink', 'query', 'query_utils', 'register_models', 'signals', 'sql', 'sy s', 'warnings', 'wraps'] |
15
xixijun 2015-05-15 02:31:37 +08:00
dir() 和 help 是个很biang的方法
|
16
Septembers 2015-05-15 16:55:42 +08:00
@xixijun dir和help不是python的基本常识么?
|
18
dalang 2015-06-21 22:36:33 +08:00
Question._meta.fields or Question._meta.get_fields() # in django 1.8
|