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
################################# | |
# | |
# Backend | |
# | |
################################# | |
# Backend to use: "xrender" or "glx". | |
# GLX backend is typically much faster but depends on a sane driver. | |
backend = "glx"; |
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
""" | |
Originaly code was taken from http://djangosnippets.org/snippets/290/ | |
But I was made some improvements like: | |
- print URL from what queries was | |
- don't show queries from static URLs (MEDIA_URL and STATIC_URL, also for /favicon.ico). | |
- If DEBUG is False tell to django to not use this middleware | |
- Remove guessing of terminal width (This breaks the rendered SQL) | |
""" | |
from django.core.exceptions import MiddlewareNotUsed | |
from django.conf import settings |
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
#!/usr/bin/env python | |
import re | |
import sys | |
import subprocess | |
from collections import defaultdict | |
MIGRATION_REGEX = r'.+\/(?P<app>.+)\/migrations\/(?P<num>\d{4})_.+.py' | |
fn, previous_head, current_head, is_branch = sys.argv | |
if not is_branch == '1' or previous_head == current_head: |
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
# __init__.py | |
default_app_config = 'apps.gallery.app.Config' | |
# app.py | |
from django.apps import AppConfig | |
class Config(AppConfig): |
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
# -*- coding: utf-8 -*- | |
import six | |
from django import template | |
from django.template.loader import render_to_string | |
from django.conf import settings | |
from django.utils.encoding import smart_text | |
from django.contrib.contenttypes.models import ContentType | |
import django_comments |
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
class MultipleFormxMixin(object): | |
form_classes = [] | |
initials = {} | |
prefixes = {} | |
form_names = [] | |
def get_forms(self, names=None): | |
names = names or self.form_names | |
if len(names) != len(self.form_classes): |