Re: Difficulty setting dynamic 'db_table' in Meta

2019-06-27 Thread Adam Johnson
So it looks to me like migrations feeds off of models.original_attrs: https://github.com/django/django/blob/master/django/db/models/options.py#L160 / https://github.com/django/django/blob/master/django/db/migrations/state.py#L453 This is set at contribute_to_class time in the Meta. The __new__ me

Re: Difficulty setting dynamic 'db_table' in Meta

2019-06-26 Thread Brock Hallenbeck
Sorry for the confusion. That post is not actually me, just an identical situation. I am in fact on 2.2. It's just frustrating because I can raise an arbitrary exception in my metaclass and makemigrations will fail because of it, so I know the code is being run. It just seems to be inexplicably

Re: Difficulty setting dynamic 'db_table' in Meta

2019-06-26 Thread Adam Johnson
Hi, The SO post shows you (?) testing on Django 1.10, have you tried with the latest 2.2? You could also try implementing this with just a class decorator which is much more likely to work, although it’s not inheritable. You could also enforce with a a custom system check for manual declaration

Difficulty setting dynamic 'db_table' in Meta

2019-06-26 Thread Brock Hallenbeck
I am trying to modify django's default table naming scheme to better suit my needs and am having some difficulty. In order to accomplish this I need access to the 'app_label' and 'model_name' attributes. However due to python's scoping, I am unable to do so in your standard Meta subclass. I ha