Jordan Caras
Jordan Caras

Reputation: 93

How to move a StreamBlock between apps

I'm refactoring some code and I wish to move a custom StreamBlock (or StructBlock) from one django app to another.

This seems like it would be much simpler than migrating tables between apps.

  1. Move the block declarations to the new app
  2. Update any dependencies to point to new module
  3. Update old migration files (imports, etc) to point to new app
  4. ... PROFIT

Is this really all we need to do? Are there any deployment risks, here - or is this really a pure python change.

Upvotes: 2

Views: 122

Answers (1)

gasman
gasman

Reputation: 25227

Assuming the block declaration itself doesn't change, and all StreamFields referencing it are updated to point to it in its new location - yes, it's a pure Python change. You don't even need to update migrations, because migrations are set up to include their own frozen copy of StreamBlock / StructBlock definitions as they existed at the time of creation, rather than pointing to the definition within your app code.

Upvotes: 3

Related Questions