@@ -30,12 +30,13 @@ def __str__(self):
30
30
return force_str (super ().__str__ ())
31
31
32
32
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 )
39
40
return super ().render (context , instance , placeholder )
40
41
41
42
if not hasattr (PlaceholderAdmin , "edit_field" ):
0 commit comments