MegaMark16 / django-cms-themes

A way to quickly load and swap out template packs (or themes) for Django CMS
BSD 3-Clause "New" or "Revised" License
49 stars 15 forks source link

Avoid missing table errors on initial syncdb or migrate. see : https://g... #2

Closed airtonix closed 12 years ago

airtonix commented 12 years ago

https://github.com/MegaMark16/django-cms-themes/issues/1

notNotDaniel commented 12 years ago

This error still occurs if using psycopg2, because the transaction is never rolled back, and any subsequent attempt to use the database fails. It appears to be possible to work around this by catching the DatabaseError and rolling back the transaction as necessary. E.g.:

def set_themes(): try: if not Site.objects.filter(id=settings.SITE_ID): return except DatabaseError: connection.rollback(); return;