File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ def get_action_class(action):
5656 return _action_registry .get (action , None )
5757
5858
59+ def get_hash (action_class ):
60+ return hashlib .sha1 (action_class .__name__ .encode ("utf-8" )).hexdigest ()
61+
62+
5963class ActionMixin :
6064 """Adds action form elements to Form plugin admin"""
6165
@@ -280,9 +284,13 @@ class Meta:
280284
281285 redirect_link = LinkFormField (
282286 label = _ ("Link" ),
283- required = True ,
284287 )
285288
289+ def __init__ (self , * args , ** kwargs ):
290+ super ().__init__ (* args , ** kwargs )
291+ if args :
292+ self .fields ["redirect_link" ].required = get_hash (RedirectAction ) in args [0 ].get ("form_actions" , [])
293+
286294 def execute (self , form , request ):
287295 form .Meta .options ["redirect" ] = get_link (
288296 self .get_parameter (form , "redirect_link" )
You can’t perform that action at this time.
0 commit comments