You can iterate over all field names, for example
for name in Company._meta.get_all_field_names(): print name
this also works if you have an instance of the category:
c = Company(name="foo",website="bar",email=" baz@qux.com ",....,) c.save() for field in c._meta.get_all_field_names(): print getattr(c, field, None)
Update for Django 1.8
Django 1.8 now has an official Meta api model
randlet
source share