Answer the question
In order to leave comments, you need to log in
How to get the field names of a Django 1.6 model?
Good afternoon!
There are 2 classes:
class ParentClass(model.Models):
...
class ChildClass(ParentClass):
...
return [(obj._meta.get_field(field.name)) for field in obj._meta.fields]
def get_only_child_fields(obj):
allfields = [(field.name) for field in obj._meta.fields]
parentfields = [(field.name) for field in Product._meta.fields]
return [f for f in allfields if f not in parentfields]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question