i have 2 tables,   1 table contain the fields for name, email, 
and I did another table with file, and date.

and I am trying to populate the 2 tables when a user submit the form.

I follow this amazing tutorial
https://amatellanes.wordpress.com/2013/11/05/dropzonejs-django-how-to-build-a-file-upload-form/
  

but he is using the trick of using the models to do the form.   witch you 
can only use one table for that.

in the mean time we change the code and we are using just 1 table, with 
name email, file and date and then doing it exactly like the tutorial, 
and my view is like this

def request_page(request):
   if request.method == "POST":
      form = Submit_Form(request.POST, request.FILES)
      if form.is_valid():
         email = form.cleaned_data["email"]
         per = Person(email=email, date=datetime.datetime.now(), 
file=request.FILES['file'])
         per.save()

         message = "Thanks, Submission accepted:    " + email
         forma = Submit_Form()
         # return redirect("request_page", {"form": forma, "message": message})
         return render(request, "submit_request.html", {"form": forma, 
"message": message})
   else:
      form = Submit_Form()

   return render(request, "submit_request.html", {"form": form, "message": ""})





I can make my own form  like this

# class NameForm(forms.Form):
#     name = forms.CharField(label='Name', max_length=100, required=True, 
initial="")
#     last_name = forms.CharField(label='Last Name', max_length=100, 
required=True, initial="")
#     email = forms.EmailField(label="Email", required=True, initial="")


#     the_file = forms.FileField(required=True)

#     date = forms.DateTimeField()



will render properly but later on I don't know how to populate the 2 tables.   

any one have a little example that I can follow to .save() the person table and 
the file table?


thank you guys. =)

-- 
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/65a0f26c-9f07-499c-88eb-fd625e6d34c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to