views:

19

answers:

1

Can i get model field type from a model queryset in Django?

For example: a is b model's queryset and the b model has following fields:

  • f:charfield
  • g:foreignkey
  • h:manytomany

Is there any way to get field g's type from queryset a? thx.

+1  A: 

i got the answer: a.model._meta.get_field('g').get_internal_type()

victor