@@ -30,12 +30,13 @@ def __str__(self):
3030 return force_str (super ().__str__ ())
3131
3232 def render (self , context , instance , placeholder ):
33- for key , value in instance .config .items ():
34- if isinstance (value , dict ) and set (value .keys ()) == {"pk" , "model" }:
35- if key not in instance .__dir__ (): # hasattr would return the value in the config dict
36- setattr (instance .__class__ , key , get_related (key ))
37- if "instance" not in instance .config and isinstance (instance .config , dict ):
38- context .update (instance .config )
33+ if hasattr (instance , "config" ):
34+ for key , value in instance .config .items ():
35+ if isinstance (value , dict ) and set (value .keys ()) == {"pk" , "model" }:
36+ if key not in instance .__dir__ (): # hasattr would return the value in the config dict
37+ setattr (instance .__class__ , key , get_related (key ))
38+ if "instance" not in instance .config and isinstance (instance .config , dict ):
39+ context .update (instance .config )
3940 return super ().render (context , instance , placeholder )
4041
4142 if not hasattr (PlaceholderAdmin , "edit_field" ):
0 commit comments