>
> so I changed it a bit after doing some more research however formb, and 
> formc don't display, if I change the 'formb' to 'form' it will overwrite 
> the first one and only display the second one.
> This is how i read the forignekey associate between multiple forms to be. 
>


from django.shortcuts import render
from django.http import HttpResponse
from vmware.models import Customer
from django.shortcuts import render_to_response
from vmware.models import Vms
from .forms import SignUpForm
from .forms import VmForm
from .forms import VmSpecForm
from vmware.models import Vmspecs
from django.views.decorators.csrf import csrf_protect
from django.template import Template, RequestContext

#@csrf_protect
def index(request):
        form = SignUpForm(request.POST or None)
        formb = VmForm(request.POST or None)
        formc = VmSpecForm(request.POST or None)

        if form.is_valid():
                save_it = form.save(commit=False)
                save_it.save()
                save_itb = formb.save(commit=False)
                save_itc = formc.save(commit=False)
                save_itb.CUSTOMERID = save_it
                save_itb.save()
                save_itc.VMID = save_itb
                save_itc.CUSTOMERID = save_it
                save_itc.save()

        customers = Customer.objects.all()
        ctx = { 'customers':customers, 'form':form, 'formb':formb, 
'formc':formc}
        return render_to_response('index.html', ctx, 
context_instance=RequestContext(request)) 


<form action='' method='POST'> {% csrf_token %}
     {{ form.as_p }}
     {{ formb.as_P }}
     {{ formc.as_P }}
     <p><input type="submit" value="Add"></p>
</form>


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fafdf14a-75ad-4f66-ae1b-be817f609641%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to