Reputation: 892
How can I check if a Model Field is in the abstract model?
I want to write a custom model_to_dict function that, only gives the field of the Abstract Model and not the related model.
So i want to exclude every field that is not in the abstract model, is that even possible?
Upvotes: 0
Views: 130
Reputation: 53326
You can try
hasattr(AbstrctModel, 'attr_name1')
If it returns True
then its in the model.
Upvotes: 1