so i'm trying to do a data migration where i take the "listings" from a realestate app into a new "listings" app that i've created.
i did startmigration like this:
python manage.py startmigration listings migrate_listings --freeze realestate
created a blank migration, which i populated with this:
def forwards(self, orm):
"Write your forwards migration here"
for listing in orm['realestate.RealEstateListing'].objects.all():
sub_type = orm.SubType.objects.get(slug_url=slugify(listing.listing_type.name))
lt = orm.Listing(listing_type=sub_type.parent,
sub_type=sub_type,
expiration_date=listing.expiration_date,
title=listing.title,
slug_url = listing.slug_url,
description = listing.description,
contact_person=listing.contact_person,
secondary_contact=listing.secondary_contact,
address=listing.address,
location=listing.location,
price=listing.price,
pricing_option=listing.pricing_option,
display_picture=listing.display_picture,
image_gallery=listing.image_gallery,
date_added=listing.date_added,
status=listing.status,
featured_on_homepage=listing.featured_on_homepage,
)
lt.save()
lt.features.clear()
for ft in listing.property_features.all:
lt.features.add(ft)
for cft in listing.community_features.all:
lt.features.add(cft)
lt.restrictions.clear()
for na in listing.not_allowed.all:
lt.restrictions.add(na)
however when i run the migration is still get this error:
whiney_method
ValueError("you cannot instantiate a stub model")
from what i understand you can't access a "stub" model using the fakeorm but freezing additional apps is not allowed. how do i go about using the "stub" models without freezing them?