[Answered ]-Three questions before I leave PHP: Formsets, datasources and remote auth

2πŸ‘

βœ…

In regards to part 1, this is much easier than you may think:

forms.py:

class UserForm(forms.ModelForm):
    pass ## Using pass so I don't have to write the whole thing.

class ProfileForm(forms.ModelForm):
    pass

class CommentForm(forms.ModelForm):
    pass

views.py:

def view_forms(request):
    userform = UserForm()
    profileform = ProfileForm()
    comment1 = CommentForm()
    comment2 = CommentForm()
    if request.method = "POST":
        ## Process forms here.  Yes, I'm lazy.
    return render_to_response("template.html",
                locals(),                       
                context_instance=RequestContext(request))

template.html:

<form method="POST">
    {{ userform.as_p }}
    {{ profileform.as_p }}
    {{ comment1.as_p }}
    {{ comment2.as_p }}
</form>
πŸ‘€Jack M.

Leave a comment