Skip to content

Commit

Permalink
Fixing a backwards-incompat issue with settings - thanks to djm for the
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
coleifer committed Oct 18, 2010
1 parent 0acd117 commit fdf3dbe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion oembed/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django import VERSION
from django.conf import settings
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
Expand All @@ -8,6 +9,12 @@
from oembed.providers import HTTPProvider


if VERSION < (1, 2):
db_engine = settings.DATABASE_ENGINE
else:
db_engine = settings.DATABASES['default']['ENGINE']


class StoredOEmbed(models.Model):
match = models.TextField()
response_json = models.TextField()
Expand All @@ -27,7 +34,7 @@ class Meta:
ordering = ('-date_added',)
verbose_name = 'stored OEmbed'
verbose_name_plural = 'stored OEmbeds'
if 'mysql' not in settings.DATABASES['default']['ENGINE']:
if 'mysql' not in db_engine:
unique_together = ('match', 'maxwidth', 'maxheight')

def __unicode__(self):
Expand Down

0 comments on commit fdf3dbe

Please sign in to comment.