From 2a26da5c95e22eb5aa596802a5ff6321e52e746e Mon Sep 17 00:00:00 2001 From: Jack Laxson Date: Tue, 14 Jun 2016 22:02:41 -0400 Subject: [PATCH 1/2] Fixes importing urls fixes django.db.utils.ProgrammingError: relation "auth_group" does not exist --- django_facebook/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_facebook/urls.py b/django_facebook/urls.py index 835f0385..8cf664a5 100644 --- a/django_facebook/urls.py +++ b/django_facebook/urls.py @@ -30,7 +30,7 @@ image_upload, name='facebook_image_upload'), url(r'^canvas/$', canvas, name='facebook_canvas'), url(r'^page_tab/$', - 'page_tab', name=facebook_page_tab), + page_tab, name='facebook_page_tab'), url(r'^open_graph_beta/$', open_graph_beta, name='facebook_open_graph_beta'), url(r'^remove_og_share/$', remove_og_share, From 9a137d57952854111cc1c9c976ecc5dc7d77d1ee Mon Sep 17 00:00:00 2001 From: jrabbit Date: Wed, 15 Jun 2016 00:33:02 -0400 Subject: [PATCH 2/2] the goal: no more weird table naming settings Remove BaseModelMetaclass, excise it from BaseModel even less magic the quest is completed. it seems to run just fine now. --- django_facebook/models.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/django_facebook/models.py b/django_facebook/models.py index e8b4db7e..7c6eff8c 100644 --- a/django_facebook/models.py +++ b/django_facebook/models.py @@ -366,36 +366,12 @@ class FacebookCustomUser(AbstractUser, FacebookModel): logger.info('Couldnt setup FacebookUser, got error %s', e) -class BaseModelMetaclass(ModelBase): - - ''' - Cleaning up the table naming conventions - ''' - - def __new__(cls, name, bases, attrs): - super_new = ModelBase.__new__(cls, name, bases, attrs) - module_name = camel_to_underscore(name) - - app_label = super_new.__module__.split('.')[-2] - db_table = '%s_%s' % (app_label, module_name) - - django_default = '%s_%s' % (app_label, name.lower()) - if not getattr(super_new._meta, 'proxy', False): - db_table_is_default = django_default == super_new._meta.db_table - # Don't overwrite when people customize the db_table - if db_table_is_default: - super_new._meta.db_table = db_table - - return super_new - - @python_2_unicode_compatible class BaseModel(models.Model): ''' Stores the fields common to all incentive models ''' - __metaclass__ = BaseModelMetaclass def __str__(self): ''' @@ -527,8 +503,6 @@ class OpenGraphShare(BaseModel): updated_at = models.DateTimeField(auto_now=True) created_at = models.DateTimeField(auto_now_add=True, db_index=True) - class Meta: - db_table = facebook_settings.FACEBOOK_OG_SHARE_DB_TABLE def save(self, *args, **kwargs): if self.user and not self.facebook_user_id: