Dica 27 - Retornando os nomes dos campos do model
$ python manage.py shell_plus
>>> [field.name for field in User._meta.get_fields()]
['logentry',
'id',
'password',
'last_login',
'is_superuser',
'username',
'first_name',
'last_name',
'email',
'is_staff',
'is_active',
'date_joined',
'groups',
'user_permissions']
>>> [field.name for field in Article._meta.get_fields()]
['id', 'title', 'subtitle', 'slug', 'category', 'published_date']
PreviousDica 26 - Rodando Python dentro do Shell scriptNextDica 28 - Admin: Usando short description
Last updated
Was this helpful?