from django.core.exceptions import MultipleObjectsReturned from utils.amazon import S3EnabledImageField from datetime import datetime, timedelta from django.core.cache import cache from django.utils.hashcompat import sha_constructor from utils.metrics import Meter from random import random from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from tastypie.models import ApiKey # I'm not sure this is the best way do do this, but this models.py is executed # before all other and before url.py from localeurl import patch_reverse patch_reverse() from utils.tasks import send_templated_email_async ALL_LANGUAGES = [(val, _(name)) for val, name in settings.ALL_LANGUAGES] EMAIL_CONFIRMATION_DAYS = getattr(settings, 'EMAIL_CONFIRMATION_DAYS', 3) class CustomUser(BaseUser): AUTOPLAY_ON_BROWSER = 1 AUTOPLAY_ON_LANGUAGES = 2 DONT_AUTOPLAY = 3 AUTOPLAY_CHOICES = ( (AUTOPLAY_ON_BROWSER, 'Autoplay subtitles based on browser preferred languages'), (AUTOPLAY_ON_LANGUAGES, 'Autoplay subtitles in languages I know'),
from django.db import models from django.db.models.signals import post_save from django.conf import settings import urllib import hashlib from django.utils.translation import ugettext_lazy as _, ugettext from django.utils.http import urlquote_plus from django.core.exceptions import MultipleObjectsReturned from utils.amazon import S3EnabledImageField from datetime import datetime, date from django.core.cache import cache #I'm not sure this is the best way do do this, but this models.py is executed #before all other and before url.py from localeurl import patch_reverse patch_reverse() ALL_LANGUAGES = [(val, _(name))for val, name in settings.ALL_LANGUAGES] class CustomUser(BaseUser): AUTOPLAY_ON_BROWSER = 1 AUTOPLAY_ON_LANGUAGES = 2 DONT_AUTOPLAY = 3 AUTOPLAY_CHOICES = ( (AUTOPLAY_ON_BROWSER, 'Autoplay subtitles based on browser preferred languages'), (AUTOPLAY_ON_LANGUAGES, 'Autoplay subtitles in languages I know'), (DONT_AUTOPLAY, 'Don\'t autoplay subtitles') ) homepage = models.URLField(verify_exists=False, blank=True) preferred_language = models.CharField(
def setup_monkeypatches(): from localeurl import patch_reverse patch_reverse()
def setup_monkeypatches(): from localeurl import patch_reverse patch_reverse() from utils.compat import monkeypatch monkeypatch.monkeypatch_old_code()
def setup_patch_reverse(): patch_reverse()
def setup_patch_reverse(): from localeurl import patch_reverse patch_reverse()