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
To install node.js and coffee-script inside a virtualenv and keep it self-contained: | |
1. Activate the virtualenv:: | |
$ workon test | |
2. Move inside the virtualenv directory:: | |
(test)$ cdvirtualenv |
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
## views.py | |
import tempfile | |
import os | |
import commands | |
import cgi | |
from django import http | |
from django.views.decorators.csrf import csrf_exempt | |
from django.shortcuts import render |
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
<!-- | |
autor: Alex Dzul @alexjs88 | |
Supongamos que tenemos miles de objetos a paginar. Django por sí solo no cuenta con una función que nos | |
permita definir cuántas páginas queremos mostrar y en tu template te podría aparecer miles de páginas: | |
< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 N1.. N2.. etc ... > | |
Si en nuestro sitio solo queremos mostrar un fragmento de páginas, entonces con este SNIP podemos definir | |
el intervalo de páginas hacia la izquierda y hacia la derecha que necesitamos. | |