How to find the class a Foreign key field relates to?
Lets get the Model field first. f1 = getattr(SomeModel, ‘fieldname’) then f1.field.rel.to will return the class object in my case it was <class ‘products.models.Manufacturer’> Which you can then use to determine if a particular object already exists f1.field.rel. … Continue reading