Yet another questions for missing migration files

I inherited a Django app without the migration files. I suppose the app was developed with an older Django version that the one on the server.

The first time python manage.py makemigrations is executed it is successful and produces 0001_initial.py file

Migration (python manage.py migrate) or new executions of makemigrations
with existent 0001_initial.py fail with a weird error:

 File "/afat/afatprivate/AFATdashboard/migrations/0001_initial.py", line 223, in Migration
bases=(models.Model, AFATdashboard.models.__support),
AttributeError: module 'AFATdashboard.models' has no attribute '_Migration__support'

I searched for _Migration__support and found nothing useful.

The error is the same with an empty database too, so this related answer didn’t solve the problem

Code from 0001_initial.py, last line is 223

 migrations.CreateModel(
        name='EconCostoCorpiIdrici3',
        fields=[
            ('waterbodycode', models.CharField(blank=True, db_column='waterBodyCode', max_length=255, null=True)),
            ('waterbodyname', models.CharField(blank=True, db_column='waterBodyName', max_length=255, null=True)),
            ('numinterventi', models.BigIntegerField(blank=True, db_column='numInterventi', null=True)),
            ('numinterventiconcosto', models.BigIntegerField(blank=True, db_column='numInterventiConCosto', null=True)),
            ('costocorpoidrico2227', models.DecimalField(blank=True, db_column='costoCorpoIdrico2227', decimal_places=65535, max_digits=65535, null=True)),
            ('coperturafinanziariacorpoidrico', models.DecimalField(blank=True, db_column='coperturaFinanziariaCorpoIdrico', decimal_places=65535, max_digits=65535, null=True)),
            ('percentualecoperturafinanziaria', models.DecimalField(blank=True, db_column='percentualeCoperturaFinanziaria', decimal_places=65535, max_digits=65535, null=True)),
            ('waterbodycostconfidence', models.DecimalField(blank=True, db_column='waterBodyCostConfidence', decimal_places=65535, max_digits=65535, null=True)),
            ('costocorpoidrico2227color', models.TextField(blank=True, db_column='costoCorpoIdrico2227Color', null=True)),
            ('recid', models.TextField(db_column='recId', primary_key=True, serialize=False)),
        ],
        options={
            'db_table': 'ECON_costo_corpi_idrici_3',
            'managed': False,
        },
        bases=(models.Model, AFATdashboard.models.__support),
    ),

What can I do ?

UPDATE 1

My models.py starts this way:

class __support:

I’m wondering if support has become a keyword

Besides I’m testing a reduced model.py and I’m finding other errors. Most DecimalFields have these attributes:

decimal_places=65535, max_digits=65535

and I suspect these numbers are too high to be supported.

4

Reading the migration file it seems that the model you are using EconCostoCorpiIdrici3 has managed=False which means that django will not create the db tables for it, it will create the migration files though. You can read more about the managed option on the docs

I guess you could remove the managed=False and recreate the migrations

1

I have finally found a workaround.
At the beginning of models.py there is this class declaration:

class __support:

It begins with a double underscore, which turned out it has a special meaning in Django.
Lots of classes inherits from __support and inside the migration file 0001_initial.py the first one is that reported above, EconCostoCorpiIdrici3

bases=(models.Model, AFATdashboard.models.__support),

I replaced __support with _mySuperclass and the migration command was successful.

It was a trivial error which cost much time because there was no clue to its real cause.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật