File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -277,3 +277,22 @@ class MyTableWithName(MyTableNameMixin, db.Model):
277
277
278
278
assert MyTableWithoutName .__table__ .name == 'mytablewithoutname'
279
279
assert MyTableWithName .__table__ .name == 'manually_overwritten_name'
280
+
281
+
282
+ async def test_multiple_inheritance_overwrite_declared_table_name ():
283
+ class MyTableNameMixin :
284
+ @db .declared_attr
285
+ def __tablename__ (cls ):
286
+ return cls .__name__ .lower ()
287
+
288
+ class AnotherTableNameMixin :
289
+ __tablename__ = "static_table_name"
290
+
291
+ class MyTableWithoutName (AnotherTableNameMixin , MyTableNameMixin , db .Model ):
292
+ id = db .Column (db .Integer , primary_key = True )
293
+
294
+ class MyOtherTableWithoutName (MyTableNameMixin , AnotherTableNameMixin , db .Model ):
295
+ id = db .Column (db .Integer , primary_key = True )
296
+
297
+ assert MyTableWithoutName .__table__ .name == 'static_table_name'
298
+ assert MyOtherTableWithoutName .__table__ .name == 'myothertablewithoutname'
You can’t perform that action at this time.
0 commit comments