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
diff --git a/medley/abcs/extensions_admin.py b/medley/abcs/extensions_admin.py | |
index 90f3db9..2e9a7d4 100644 | |
--- a/medley/abcs/extensions_admin.py | |
+++ b/medley/abcs/extensions_admin.py | |
@@ -216,6 +216,7 @@ class MedleyBaseModelAdminForm(BaseModelForm): | |
def clean_primary_category(self): | |
primary_category = self.cleaned_data.get('primary_category') | |
+ return primary_category | |
if primary_category: |
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
>>> thing = type('name', (object,), {'hello':'hello world'})() | |
>>> thing.hello | |
'hello world' | |
class name(object): | |
hello = 'hello world' |
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
def _build_coherent_name(field, parent): | |
return parent and '.'.join((parent, field)) or field | |
def _verify_fields_recursive(expected, data, parent=None): | |
analysis = {} | |
for field, field_info in expected.items(): | |
coherent_name = _build_coherent_name(field, parent) | |
status = field in data and 'found' or 'missing', |
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
# Change this to match your user. | |
username = 'daniel' | |
from tastypie.models import ApiKey | |
from django.contrib.auth.models import User | |
my_user = User.objects.get(username=username) | |
key, created = ApiKey.objects.get_or_create(user=my_user) | |
# Now use key.key for the digest password. |
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
+ body_text = indexes.CharField(model_attr='bio') | |
+ body_text = indexes.CharField(model_attr='blurb') | |
+ body_text = indexes.CharField(model_attr='body') | |
+ body_text = indexes.CharField(model_attr='caption') | |
+ body_text = indexes.CharField(model_attr='description') | |
+ body_text = indexes.CharField(model_attr='description') | |
+ body_text = indexes.CharField(model_attr='description') | |
+ body_text = indexes.CharField(model_attr='long_description') | |
+ body_text = indexes.CharField(model_attr='question') | |
+ body_text = indexes.CharField(model_attr='story') |
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
what_i_want = dict( | |
name = performer.name, | |
slug = slug, | |
sound_description = performer.short_bio, | |
history = performer.long_bio, | |
eventful_id = performer.id, | |
primary_category_id = PERFORMER_CATEGORY, | |
website = website, | |
) |
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
diff --git a/medley/extensions/search_indexes.py b/medley/extensions/search_indexes.py | |
index 852edfd..c060df6 100644 | |
--- a/medley/extensions/search_indexes.py | |
+++ b/medley/extensions/search_indexes.py | |
@@ -57,6 +57,7 @@ from ellington.maps.search_indexes import StaticMapIndex | |
from ellington.places.search_indexes import PlaceIndex | |
from ellington.movies.search_indexes import MovieIndex | |
+from django.contrib.contenttypes.models import ContentType | |
from django.contrib.auth.models import User |
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
@periodic_task(run_every=timedelta(hours=1), ignore_result=True ) | |
def reset_cac_timeslots(): | |
""" | |
Reset the available appointments in any CAC time slot that ended in the last hour. | |
Note that this code is not timezone aware and therefore may not behave | |
as expected if a time slot ends between 2 and 3 AM. | |
""" | |
now = datetime.now() | |
day_start = datetime.combine(now.date(), datetime.time(now).min) |
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
diff --git a/medley/playlist/tests/tests.py b/medley/playlist/tests/tests.py | |
index 56d7ca4..b350f56 100644 | |
--- a/medley/playlist/tests/tests.py | |
+++ b/medley/playlist/tests/tests.py | |
@@ -15,6 +15,9 @@ from medley.playlist.models import Artist, Track, History, ArtistImage, Snapshot | |
from medley.playlist.trailer.amazon import AmazonTrailer | |
+class RequiresAMGTestCase(TestCase): | |
+ requires_databases = ['default', 'amgdb'] |
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
from datetime import time | |
from datetime import datetime | |
broadcast_start = time(*map(int, time(12,41,).strftime('%H:%M').split(':'))) | |
broadcast_end = time(*map(int, time(15,41,).strftime('%H:%M').split(':'))) | |
broadcast_start <= datetime.now().time() < broadcast_end |