单击按钮后,我试图将LinkedIn中的剪贴数据保存到SQL数据库中。
我尝试过使用Django模型和视图保存数据,但是没有任何效果。
def home(request):
form = ProfileData(request.POST)
if request.method == 'POST':
form.save()
return render(request,'ScreeningWebApp/home.html',{'form':form})
I want to save data coming in the below variables which are in another function
def extract():
name = validate_field(name)
job_title = validate_field(job_title)
company = validate_field(company)
college = validate_field(college)
location = validate_field(location)
linkedin_url = validate_field(linkedin_url)
class ProfileData(models.Model):
name = models.CharField(max_length=100)
job_title = models.CharField(max_length=100)
company = models.CharField(max_length=100)
college = models.CharField(max_length=200)
location = models.CharField(max_length=100)
linkedin_url = models.CharField(max_length=200)
def __unicode__(self):
return "{0} {1} {2} {3} {4} {5}".format(self.name,self.job_title,self.company,self.college,self.location,self.linkedin_url)
<form action= '' method="POST" novalidate>
{% csrf_token %}
<button type="submit" class="btn btn-primary btn-lg">Start Searching..</button>
<h1>{{ data }}</h1>
</form>