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
| Dreamer [Saito], level [1], priority [0], policy [OTHER] | |
| Dreamer [Eames], level [1], priority [0], policy [OTHER] | |
| Dreamer [Ariadne], level [1], priority [0], policy [OTHER] | |
| Dreamer [Fischer], level [1], priority [0], policy [OTHER] | |
| Dreamer [Yusuf], level [1], priority [0], policy [OTHER] | |
| Dreamer [Arthur], level [1], priority [0], policy [OTHER] | |
| Dreamer [Cobb], level [1], priority [0], policy [OTHER] | |
| [Fischer] HIJACKED ! Open up my defense projections in my dream to the hijackers! | |
| [Saito] sees Fischers defense projections at work in the dream at level [1] | |
| [Saito] shot in level 1. Following Cobb to level 2 |
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
| from django.utils import importlib | |
| def lazy_listen(signal, reciever, sender=None): | |
| if sender and isinstance(sender, basestring): | |
| module, obj = sender.rsplit('.', 1) | |
| mod = importlib.import_module(module) | |
| sender = getattr(mod, obj) | |
| signal.connect(reciever, sender=sender) |
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
| from datetime import date, timedelta | |
| from django.db.models import Q | |
| def next_birthdays(qs, days, fieldname): | |
| def f(*args): | |
| args = list(args) | |
| last = args.pop(-1) | |
| names = [fieldname] + args | |
| return {'__'.join(names): last} | |
| now = date.today() |
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
| def next_birthdays(qs, days, fieldname): | |
| def s(part, op, val): | |
| return "EXTRACT(%s FROM %s) %s %s" % (part, fieldname, op, val) | |
| now = date.today() | |
| limit = now + timedelta(days=days) | |
| lo_day = now.day | |
| lo_month = now.month | |
| hi_day = limit.day | |
| hi_month = limit.month | |
| if hi_day > lo_day: |
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 -*- | |
| from django.db import models | |
| from translateable.models import TranslatedModel | |
| class MyModel(TranslatedModel): | |
| non_translated_field = models.IntegerField() | |
| class Translations(models.Model): | |
| translateable_field = models.IntegerField() |
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
| from django.forms.fields import ChoiceField | |
| from django.forms.models import ModelChoiceField, ModelMultipleChoiceField | |
| class CachedModelChoiceIterator(object): | |
| def __init__(self, field): | |
| self.field = field | |
| self.queryset = field.queryset | |
| self.model = field.queryset.model |
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
| context.update({ | |
| 'gallery': instance.gallery, | |
| 'object': instance, | |
| 'placeholder': placeholder, | |
| }) |
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
| # install virtualenv either using apt-get, yum, pip, easy_install or directly from http://pypi.python.org/pypi/virtualenv/1.5.1 | |
| # this tutorial assumes you use a proper operating system (read: no windows) | |
| # you should start this series of commands from your workspace | |
| # If you use another database than mysql you have to replace pip install mysql-python with the appropriate database connector | |
| virtualenv --no-site-packages yourprojectname | |
| cd yourprojectname | |
| . bin/activate | |
| pip install django | |
| pip install PIL | |
| pip install mysql-python |
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
| def render_page(request, page): | |
| context = RequestContext(request) | |
| context['lang'] = get_language_from_request(request) | |
| context['current_page'] = page | |
| context['has_change_permissions'] = page.has_change_permission(request) | |
| request._current_page_cache = page | |
| render_to_response(page.get_template(), context) |
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
| from __future__ import with_statement | |
| from unittest import TestCase | |
| from tempfile import template, mkdtemp, _exists | |
| from sphinx.application import Sphinx | |
| import os | |
| try: | |
| from cStringIO import StringIO | |
| except ImportError: | |
| from StringIO import StringIO |