django - Inline Formset Object Not Iterable -


my ultimate goal here save action modelforms given website (the foreign key). after form validation, want sum points individual actions , confirm it's below threshold (100 points) before save actions. if total exceeds 100, i'll raise validationerror.

my issue here i'm receiving following error message:

"'actionformformset' object not iterable"

the instances exist, issue seems iterating on particular object. in official documentation, there's example iterates on modelformset in exact fashion. however, modelformset populated queryset, whereas inlineformset not explicitly populated in same way(maybe implicitly, don't know).

can not iterate on object? should here?

thanks

 actionformset=inlineformset_factory(website, action, extra=1, can_delete=true)  if request.method=='post':      action_formset=actionformset(request.post, instance=website,prefix="actions")      if action_formset.is_valid():          #after validating surveys, need make sure total points<100         form in action_formset:             pass         action_formset.save() 

first save formset iterate on objects

forms = action_formset.save( commit = false) 

now iterate on forms by:

for form in forms:     # 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -