from django.shortcuts import render

from .forms import SerachForm

# Create your views here.

from pkgs.webscrap import scrap as sc


def get_name(request):
    product = ''
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = SerachForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            # ...
            # redirect to a new URL:
            product = form.cleaned_data['search']
            price = sc.get_urls(product)
            price_avi = price[:5]

            return render(request, 'compareprice/name.html', {'form': form, 'data': price_avi})

            # if a GET (or any other method) we'll create a blank form
    else:
        form = SerachForm()
    price = sc.get_urls(product)
    price_avi = price[:5]
    return render(request, 'compareprice/name.html', {'form': form, 'data': price_avi})

@@ -130,49 +130,160 @@
  sc%0A
-%0A%0Adef get_name(request):%0A    product = ''
+from from pkgs.webscrap import scraper as scr%0A%0A%0Adef get_name(request):%0A    product = ''%0A    scraper = scr.TaleoJobScraper()%0A    title = scraper.scrape()
 %0A   
@@ -896,16 +896,35 @@
 rice_avi
+, 'scr_title':title
 %7D)%0A%0A    
@@ -1087,16 +1087,21 @@
 ice%5B:5%5D%0A
+    %0A
     retu
@@ -1177,11 +1177,30 @@
 rice_avi
+, 'scr_title':title
 %7D)%0A

use phantomjs to scrap