Пример #1
0
def send_form(request, form):
	print 'in send form'
	dajax = Dajax()
	form = Search_Form(deserialize_form(form))

	print 'errors'
	print form.errors
	
	# must do this to clean the form
	if form.is_valid():

		print 	'form is valid'
		cars 	= make_query(form)
		items 	= land_page_pagination(page=1, items=cars)
		render 	= render_to_string('./parts/pagination_page2.html', {'items': items})

		
		dajax 	= Dajax()

		dajax.assign('#respo', 'innerHTML', render)
		# print(dir(dajax.json()))
		return dajax.json()

	else:
		dajax.alert('error in form validation')

	return dajax.json()
Пример #2
0
def text_send_form(request, form):
	print 'in text send form'
	query_string 	= ''
	found_entries 	= None
	dajax 			= Dajax()
	form 			= Text_Search_Form(deserialize_form(form))

	print 'errors'
	print form.errors
	
	# must do this to clean the form
	if form.is_valid():
		print 'form is valid'
		text 			= form.cleaned_data['target_text']
		query_string 	= text
		entry_query 	= get_query(query_string, ['title', 'category',])
		print entry_query
		found_entries 	= Offer.objects.filter(entry_query)
		items 			= land_page_pagination(page=1, items=found_entries)
		render 			= render_to_string('./parts/pagination_page2.html', {'items': items})
		dajax 			= Dajax()
		dajax.assign('#respo', 'innerHTML', render)
		return dajax.json()

	else:
		dajax.alert('error in form validation')

	return dajax.json()
Пример #3
0
def text_send_form(request, form):
    print "in text send form"
    query_string = ""
    found_entries = None
    dajax = Dajax()
    form = Text_Search_Form(deserialize_form(form))

    print "errors"
    print form.errors

    # must do this to clean the form
    if form.is_valid():
        print "form is valid"
        text = form.cleaned_data["target_text"]
        query_string = text
        entry_query = get_query(query_string, ["title", "category"])
        print entry_query
        found_entries = Offer.objects.filter(entry_query)
        items = land_page_pagination(page=1, items=found_entries)
        render = render_to_string("pagination_page2.html", {"items": items})
        dajax = Dajax()
        dajax.assign("#respo", "innerHTML", render)
        return dajax.json()

    else:
        dajax.alert("error in form validation")

    return dajax.json()
Пример #4
0
def pagination2(request, p, form):
	print 'in pagination 2'
	form = Search_Form(deserialize_form(form))
	
	if form.is_valid():
		cars 	= make_query(form)
		items 	= land_page_pagination(page=p, items=cars)
		render 	= render_to_string('./parts/pagination_page2.html', {'items': items})
		dajax 	= Dajax()
		dajax.assign('#respo', 'innerHTML', render)

		return dajax.json()

	else:
		dajax.alert('error in form validation')

	return dajax.json()
Пример #5
0
def pagination2(request, p, form):
    print "in pagination 2"
    form = Search_Form(deserialize_form(form))

    if form.is_valid():
        cars = make_query(form)
        items = land_page_pagination(page=p, items=cars)
        render = render_to_string("pagination_page2.html", {"items": items})
        dajax = Dajax()
        dajax.assign("#respo", "innerHTML", render)

        return dajax.json()

    else:
        dajax.alert("error in form validation")

    return dajax.json()
Пример #6
0
def send_form(request, form):
    print "in send form"
    dajax = Dajax()
    form = Search_Form(deserialize_form(form))

    print "errors"
    print form.errors

    # must do this to clean the form
    if form.is_valid():

        print "form is valid"
        cars = make_query(form)
        items = land_page_pagination(page=1, items=cars)
        render = render_to_string("pagination_page2.html", {"items": items})
        dajax = Dajax()

        dajax.assign("#respo", "innerHTML", render)
        return dajax.json()

    else:
        dajax.alert("error in form validation")

    return dajax.json()