我想通过queryset
获取Django
模型的字段名。
Models.py:
class User1(models.Model):
types1 = (
('a', 'a'),
('b', 'b'),
('c', 'c'),
)
types2 = (
('a', 'a'),
('b', 'b'),
('c', 'c'),
)
q1 = models.CharField (
'Today1',
max_length=200,
choices=types1, blank=True, null=True, default='---------'
)
q2 = models.CharField (
'Today2',
max_length=200,
choices=types2, blank=True, null=False, default='---------',
)
在queryset
之后,我想得到[q1,q2]
或类似的东西,但只包含字段名。
转载请注明出处:http://www.runhoujixie.com/article/20230526/1749841.html