This file contains 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
class Post (models.Model): | |
content = Txtfld ... | |
class Visitor(User): | |
post = models.ForeignKey(Post) | |
# views when each page loads | |
This file contains 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
@login_required | |
def delete_videonote(request,id): | |
"""API: VideoNote delete""" | |
result = create_result() | |
v=VideoNote.objects.get(id=id) | |
form = VideoNoteDeleteApiForm(instance=v,request.POST or None) | |
if form.is_valid() and form.user==rquest.user: | |
try: |
This file contains 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 PIL import Image | |
#your views | |
slider = YourImageModel.objects.get(id=id) | |
watermark = Image.open("path to your watermark image file") | |
img = Image.open(slider.image.file) |
This file contains 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 |
This file contains 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 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 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 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 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 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') |
OlderNewer