This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = requests.post('https://www.google.com/recaptcha/api/siteverify',\ | |
data = {'secret':private_key,'remoteip':get_client_ip(request),'response':rp('token')},verify=True) | |
if result.json()['success']: | |
def get_client_ip(request): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shorthand for $( document ).ready() | |
$(function() { | |
$.get( "{% url 'sanjay' %}", {'q':'xyz'}) | |
.done(function( returndata ){ | |
if(returndata.status == 'success') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def sanjay(request): | |
rg = request.GET.get | |
print rg('q') | |
response_data = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger | |
paginator = Paginator(customers, 30) | |
page = rg('page') | |
try: | |
customers = paginator.page(page) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- PAGINATION SECTION START --> | |
{% if customers %} | |
<nav> | |
<ul class="pagination"> | |
{% if customers.has_previous %} | |
<li> <a href="?{% for key, values in request.GET.iterlists %}{% ifnotequal key "page" %}{% for value in values%}{{key}}={{value}}&{% endfor %}{% endifnotequal %}{% endfor %}page={{customers.previous_page_number}}" aria-label="Previous"> <span aria-hidden="true">«</span> </a> </li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<link href="font/fonts.css" rel="stylesheet" type="text/css"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<title>Ammras- Mobile App</title> | |
<link rel="stylesheet" type="text/css" href="css/style.css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create a list of integers from 2 to 30, and another list from 3-50 | |
def 2_30(): | |
a = [] | |
return a.append(range(2,33)) | |
def 3_50(): | |
a = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filenames = ["/home/node4/anish/varnan/1.jpg", "/home/node4/anish/varnan/2.jpg"] | |
import zipfile | |
import glob, os | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zipfile | |
import StringIO | |
from django.http import HttpResponse | |
def getfiles(request): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#settings.py | |
FRESHDESK_URL = 'YOUR FRESHDESK URL' | |
FRESHDESK_SECRET_KEY = 'YOUR Single Sign On KEY' # you can find admin->security inside freshdesk admin | |
#views.py | |
from django.http import Http404 |
NewerOlder