Skip to content

Instantly share code, notes, and snippets.

makemessages:
cd $(PROJECT_DIR) && @DJANGO_SETTINGS_MODULE=usermanagement.settings $(PTYHON) ../manage.py makemessages --all --ignore=env/* --ignore=tmp/*
{% load i18n standard_form %}
{% if input_type == 'radiocheck' %}
{% if not no_label %}<label class="empty">&nbsp;</label>{% endif %}
<div class="field">
<label>
{% if not no_error_text %}{% for error in field.errors %}<span class="text-error">{{ error }}</span> {% endfor %}{% endif %}
{% standard_widget field options custom_class=custom_class placeholder=placeholder input_type=input_type %}
{{ field.label }}{% if not no_required_helper and field.field.required %}<abbr title="{% trans 'required' %}">*</abbr>{% endif %}
{% if not no_help_text and field.help_text %}<span class="text-info">{{ field.help_text }}</span> {% endif %}
</label>
class Group(models.Model):
students = models.ManyToManyField(Student, related_name='groups',
through='StudentGroupMembership')
@property
def active_students(self):
return Student.objects.filter(
StudentGroupMembership.get_active_lookup())
@GaretJax
GaretJax / test_events.py
Last active August 29, 2015 14:05
after_flush_postexec events skipped when removing handlers
python -m unittest test_events
.F...F
======================================================================
FAIL: testDoubleRemove (sqlalchemy_mptt.tests.test_flush.FlushingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "sqlalchemy_mptt/tests/test_flush.py", line 60, in testDoubleRemove
self.assertEqual(self.calls, 2)
AssertionError: 1 != 2
Example command line usage:
php -f table.php > out.html
@GaretJax
GaretJax / setup.py
Last active August 29, 2015 14:04
pm
#=======================================================================
# Copyright (c) 2014 Baptiste Wicht
# Distributed under the terms of the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
#=======================================================================
import os
from setuptools import setup, find_packages
class Shop(Base):
__tablename__ = 'shop_config'
id = Column('site_id', Integer, primary_key=True)
class Order(Base):
__tablename__ = 'shop_order'
id = Column(Integer, primary_key=True)
select p.id as publication, count(distinct a.id) as authors, i.country, p.year
from affiliated_author as a
join publication as p on p.id = a.publication_id
join institution as i on i.id = a.institution_id
where a.publication_id in (
-- Publications with any author from Kuwait published on or before 2005
select distinct p.id
from publication as p
join affiliated_author as a on a.publication_id = p.id
join institution as i on a.institution_id = i.id
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:INFO:dbus_service.cc(94)] Attempt update: app_version="" omaha_url="" interactive=yes
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:INFO:update_attempter.cc(526)] New update check requested
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:INFO:gpio_handler.cc(588)] GPIOs not engaged, defaulting to normal mode
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:ERROR:chrome_browser_proxy_resolver.cc(64)] Error getting dbus proxy for org.chromium.LibCrosService: GError(3): Could not get owner of name 'org.chromium.LibCrosService': no such name
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:ERROR:chrome_browser_proxy_resolver.cc(104)] proxy_ failed.
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:WARNING:libpolicy.cc(29)] Could not load the device policy file.
Apr 11 09:08:49 srv-khnb3 update_engine[2915]: [0411/090849:INFO:update_attempter.cc(229)] No device policies/settings present.
Apr 11 09:
def deploy(self, host, config):
client = host.get_client()
ports = {'{0[port]}/{0[type]}'.format(p): {} for p in config['ports']}
volumes = {v: {} for v in config['shared-folders']}
binds = {v: k for k, v in config['shared-folders'].iteritems()}
port_bindings = (
p for p in config['ports']
if 'host_ip' in p or 'host_port' in p