Sophia
unread,Apr 11, 2012, 12:54:06 PM4/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi all,
I have a question about how to enter data in django's database. I have the following Template, in which ' E ' is a variable that get the string:
<form action="." method="GET"><input type="text" name="E" style="width: 450px;height: 30px;" /></form>
This is my models.py in which I have a class named 'Company' and I want this variable 'E' be saved in 'Subject' :
class Company(models.Model):
Subject = models.CharField(max_length=30)
start_time = models.DateTimeField()
end_time = models.DateTimeField()
def __unicode__(self):
return self.Subject
Then in views.py I wrote something like this to save the variable in Subject field, it's incomplete, and I want you to help me about it :
def Text_Box(request):
T = request.GET.get(E,' ')
if T:
# I don't know how to make an object of class 'Company' so then I save ' T ' in Company.Subject
else:
return render_to_response("Base.html") # Base.html is my basic template file
I would really appreciate if you help me with it.
Thanks in advance.
Sophia