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 TemplatesTest(TestCase): | |
def test_templates(self): | |
"""Templates can compile properly and there's no mismatched tags""" | |
# get app template dirs | |
template_dirs = [] | |
apps = [app for app in settings.INSTALLED_APPS | |
if app.startswith('rh2')] | |
for app in apps: | |
mod = import_module(app) |
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
<script src="{% static "admin/js/jquery.js" %}"></script> | |
<script src="{% static "admin/js/jquery.init.js" %}"></script> | |
<script src="{% static "admin/js/urlify.js" %}"></script> | |
<script src="{% static "admin/js/prepopulate.js" %}"></script> | |
<script> | |
// adaptation from django/contrib/admin/templates/admin/prepopulated_fields_js.html | |
(function($) { | |
var field = { | |
id: '#{{ form.###DESTINATION FIELD NAME###.auto_id }}', | |
dependency_ids: ['#{{ form.###SOURCE FIELD NAME###.auto_id }}'], |
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
.PHONY: all help translate test clean update compass collect rebuild | |
SETTINGS={{ project_name }}.settings | |
TEST_SETTINGS={{ project_name }}.test_settings | |
# target: all - Default target. Does nothing. | |
all: | |
@echo "Hello $(LOGNAME), nothing to do by default" | |
@echo "Try 'make help'" |
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
#!/bin/sh | |
# | |
# This pre-commit hook tests that the documentation builds correctly. | |
# It can be disabled by using the "-n" option with "git commit". | |
# | |
# See http://git-scm.com/book/en/Customizing-Git-Git-Hooks for details. | |
# | |
# This pre-commit hook requires that you have the "###PROJECT###" project on your python | |
# path, in order for the DJANGO_SETTINGS_MODULE=###PROJECT###.settings to work. | |
# This is needed to build the apidoc. |
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
module Main exposing (main) | |
import Html exposing (Html, text) | |
import Json.Decode as Decode exposing (Decoder) | |
loggingDecoder : Decoder a -> Decoder a | |
loggingDecoder realDecoder = | |
Decode.value | |
|> Decode.andThen |
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
# -*- coding: utf-8 -*- | |
"""Add permissions for proxy model. | |
This is needed because of the bug https://code.djangoproject.com/ticket/11154 | |
in Django (as of 1.6, it's not fixed). | |
When a permission is created for a proxy model, it actually creates if for it's | |
base model app_label (eg: for "article" instead of "about", for the About proxy | |
model). |
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
/* | |
* Only useful in changelist pages when the ModelAdmin displayed has | |
* "list_editable" (https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable) | |
* configured. | |
* | |
* When one of the input/select/textarea value is changed, automatically submit | |
* the form using ajax. | |
* | |
* Only form fields relevant to the "list_editable" will trigger a form submit. | |
* |
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
"""start with: | |
gunicorn utilery.views_aiohttp_aiopg:app -b 0.0.0.0:3579 -w 4 -k aiohttp.worker.GunicornWebWorker""" | |
import asyncio | |
import json | |
import math | |
import time | |
import psycopg2 | |
import psycopg2.extras |
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
So I've installed a dead simple backup, in /home/USER/git_backup/: | |
git clone --mirror git@github.com:USER/PROJECT.git | |
update.sh (launched every 5 minutes by cron): | |
#/bin/sh | |
cd /home/USER/git_backup/PROJECT.git | |
LINES=`git remote update 2>&1 | wc -l` |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals, absolute_import, division | |
import pytest | |
from django_webtest import DjangoTestApp, WebTestMixin | |
class Stub(object): | |
"""Stub methods, keep track of calls.""" |
NewerOlder