尝试将从LinkedIn上删除的数据保存到SQL数据库中

时间:2019-01-29 05:09:31

标签: sql django django-models django-views

单击按钮后,我试图将LinkedIn中的剪贴数据保存到SQL数据库中。

我尝试过使用Django模型和视图保存数据,但是没有任何效果。

views.py

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)

models.py

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)

html

  <form action= '' method="POST" novalidate>
             {% csrf_token %}
                 <button type="submit" class="btn btn-primary btn-lg">Start Searching..</button>
                 <h1>{{ data }}</h1>
              </form>

0 个答案:

没有答案