Skip to content

Instantly share code, notes, and snippets.

View vshjxyz's full-sized avatar
🌀

Luca Del Bianco vshjxyz

🌀
View GitHub Profile
@vshjxyz
vshjxyz / auth.py
Last active January 4, 2016 21:59
Code examples
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
from tastypie.authorization import Authorization
from tastypie.exceptions import Unauthorized
from django.db.models import Q
from apps.authorization.models import UserType
from apps.pos.models import Pos
class SubdomainAuthorization(Authorization):
@vshjxyz
vshjxyz / _settings.scss
Created October 28, 2013 12:16
SCSS variables of FlatUIColors
$turquoise : #1abc9c;
$emerland : #2ecc71;
$peterriver : #3498db;
$amethyst : #9b59b6;
$wetasphalt : #34495e;
$greensea : #16a085;
$nephritis : #27ae60;
$belizehole : #2980b9;
$wisteria : #8e44ad;
$midnightblue: #2c3e50;
@vshjxyz
vshjxyz / Appfog django south migrate.py
Last active December 13, 2015 23:58
This is the content of my __init__.py to perform migrations on appfog I needed this because the django-allauth package need to do some migrations initially to work. The Appfog's lack of post-deploy scripts forced me to create a script that I had to put inside one of the apps in my project django_project/appname/management/__init__.py should make…
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.models.signals import post_syncdb
from south.models import MigrationHistory
import pizzanuvola_teaser.settings as settings
def migration_exists(appname, migrationnumber):
appname = appname.split('.')[-1]
return MigrationHistory.objects.filter(app_name=appname, migration__icontains=migrationnumber).exists()
@vshjxyz
vshjxyz / Tastypie datatables with pagination.coffee
Last active February 28, 2019 06:23
This is a simple example of a working datatable using tastypie. I also Implemented the fnServerData so the datatable can paginate, search (via a query parameter configured in tastypie in the apply_filter method of the OrderResource), and sort columns using custom logics via the order_by parameter of tastypie.
@orders_table = $('#orders-table', element).dataTable
bProcessing: true
bServerSide: true
sAjaxSource: ORDERFULL_API
sAjaxDataProp: "objects"
aoColumns: [
# Put the resource name that corresponds to each table column
{
"mData": "id"
"sClass": "order-id"