#28746: New model missing abstract model inherited Meta/Options
-------------------------------------+-------------------------------------
     Reporter:  JP Navarro           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.10
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  abstract Meta        |             Triage Stage:
  inheritance                        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by JP Navarro):

 Replying to [comment:3 Tim Graham]:
 > With your sample code, I get an exception even on Django 1.9 and older:
 `TypeError: 'class Meta' got invalid attribute(s): db_name`. If you see a
 behavior change, can you
 [https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
 tickets/#bisecting-a-regression bisect] to find the commit where it
 changed? Even if there's a behavior change, I don't think there's much
 obligation to restore the old behavior as it's undocumented and untested.

 Ah, I missed the following code in a custom router where the db_name model
 Meta attribute gets used:

 import django.db.models.options as options
 options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('db_name',)

 So, i tracked the problem down to makemigrations which isn't propagating
 the 'db_name' attribute to the migration. Does this help narrow down what
 change caused this, or do you still need the commit where it changed?

 Incidentally, if there is a better way to identify a database where a
 model is suppose to exist I'm open to suggestions. The goal is to identify
 it with the Model and not somewhere unrelated like a custom router.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28746#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.59b9dd42f6e9a2a77e0749c591787622%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to