Skip to content

Instantly share code, notes, and snippets.

View mick88's full-sized avatar

Michal Dabski mick88

View GitHub Profile
@mick88
mick88 / mixin.py
Last active November 6, 2016 12:15 — forked from cyberdelia/mixin.py
Django class based view mixins
# -*- coding: utf-8 -*-
import random
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, never_cache
from django.views.decorators.csrf import csrf_exempt
@mick88
mick88 / virtualenv-auto-activate.sh
Created August 31, 2016 09:31 — forked from codysoyland/virtualenv-auto-activate.sh
virtualenv-auto-activate-windows
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@mick88
mick88 / check_migrations.py
Last active November 23, 2015 10:20 — forked from nealtodd/gist:a8f87b0d95e73eb482c5
Django management command to detect missing migration files.
import sys
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connections
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from django.db.utils import OperationalError