[PR #315] [MERGED] Fixed migrations for new deployments, added unit tests #493

Closed
opened 2026-02-27 15:58:55 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/retspen/webvirtcloud/pull/315
Author: @Real-Gecko
Created: 5/28/2020
Status: Merged
Merged: 6/3/2020
Merged by: @retspen

Base: masterHead: master


📝 Commits (6)

  • 85929b5 Fixe migrations for new deployments
  • 83b1dde Added admin app unit tests
  • 7b0016c Some test for computes
  • 5ab22ba Added accounts test(moved from admin)
  • 7103c52 Reworked some computes forms and views
  • 10b6f88 Added coverage.py support

📊 Changes

40 files changed (+507 additions, -573 deletions)

View changed files

📝 .gitignore (+2 -0)
📝 accounts/__init__.py (+1 -0)
accounts/admin.py (+0 -3)
accounts/apps.py (+51 -0)
accounts/backends.py (+0 -13)
accounts/migrations/0002_addAdmin.py (+0 -23)
📝 accounts/migrations/0002_permissionset.py (+2 -2)
accounts/migrations/0004_apply_change_password.py (+0 -25)
accounts/migrations/0005_remove_userattributes_can_clone_instances.py (+0 -18)
📝 accounts/models.py (+1 -0)
📝 accounts/tests.py (+27 -2)
📝 admin/forms.py (+1 -1)
📝 admin/templates/admin/common/form.html (+1 -0)
admin/tests.py (+120 -0)
📝 admin/views.py (+1 -1)
computes/admin.py (+0 -3)
📝 computes/forms.py (+33 -131)
computes/migrations/0002_auto_20200529_1320.py (+18 -0)
📝 computes/models.py (+1 -1)
computes/templates/computes/form.html (+29 -0)

...and 20 more files

📄 Description

So, putting all those RunPython inside migrations was a bad idea, breaking migrations for new installs and unit tests. Here are some fixes. Moved admin creation and migration of can clone to post_migrate signals, which is not that exciting, but better than fixtures or some other workarounds.
can_clone_instances user attribute is in the model again, but is hidden from forms. If you're planning new release I think it's better to remove it at all and recreate all migrations from scratch.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/retspen/webvirtcloud/pull/315 **Author:** [@Real-Gecko](https://github.com/Real-Gecko) **Created:** 5/28/2020 **Status:** ✅ Merged **Merged:** 6/3/2020 **Merged by:** [@retspen](https://github.com/retspen) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (6) - [`85929b5`](https://github.com/retspen/webvirtcloud/commit/85929b5327ce7dfbfe528546cf484b3df6b19056) Fixe migrations for new deployments - [`83b1dde`](https://github.com/retspen/webvirtcloud/commit/83b1dde67332504071d8234a3ff9d8b9d2fcd622) Added admin app unit tests - [`7b0016c`](https://github.com/retspen/webvirtcloud/commit/7b0016c0b294f355e4158e11643f885e3ed3e2a6) Some test for computes - [`5ab22ba`](https://github.com/retspen/webvirtcloud/commit/5ab22ba9475d843d513e6ad915a1902a594e4845) Added accounts test(moved from admin) - [`7103c52`](https://github.com/retspen/webvirtcloud/commit/7103c523800faa3fa5bcf03f4b970f2992c4f266) Reworked some computes forms and views - [`10b6f88`](https://github.com/retspen/webvirtcloud/commit/10b6f88dbb54fe6ed41943dfedd99c886862c14e) Added coverage.py support ### 📊 Changes **40 files changed** (+507 additions, -573 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) 📝 `accounts/__init__.py` (+1 -0) ➖ `accounts/admin.py` (+0 -3) ➕ `accounts/apps.py` (+51 -0) ➖ `accounts/backends.py` (+0 -13) ➖ `accounts/migrations/0002_addAdmin.py` (+0 -23) 📝 `accounts/migrations/0002_permissionset.py` (+2 -2) ➖ `accounts/migrations/0004_apply_change_password.py` (+0 -25) ➖ `accounts/migrations/0005_remove_userattributes_can_clone_instances.py` (+0 -18) 📝 `accounts/models.py` (+1 -0) 📝 `accounts/tests.py` (+27 -2) 📝 `admin/forms.py` (+1 -1) 📝 `admin/templates/admin/common/form.html` (+1 -0) ➕ `admin/tests.py` (+120 -0) 📝 `admin/views.py` (+1 -1) ➖ `computes/admin.py` (+0 -3) 📝 `computes/forms.py` (+33 -131) ➕ `computes/migrations/0002_auto_20200529_1320.py` (+18 -0) 📝 `computes/models.py` (+1 -1) ➕ `computes/templates/computes/form.html` (+29 -0) _...and 20 more files_ </details> ### 📄 Description So, putting all those RunPython inside migrations was a bad idea, breaking migrations for new installs and unit tests. Here are some fixes. Moved admin creation and migration of `can clone` to post_migrate signals, which is not that exciting, but better than fixtures or some other workarounds. `can_clone_instances` user attribute is in the model again, but is hidden from forms. If you're planning new release I think it's better to remove it at all and recreate all migrations from scratch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:58:55 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtcloud#493
No description provided.