jazzband / django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.
MIT License
1.71k stars 448 forks source link

Move Phone model to the correct app while keeping data #527

Closed mick88 closed 2 years ago

mick88 commented 2 years ago

Description

Fixes issue #519 by adding state migration to the phone plugin app. This MR moves the model to the same app where model code resides. Note that all operations in this MR are purely state migrations and no database operations are carried out therefore there is no risk of data loss. The table name is hardcoded as to avoid renaming database table following the model being moved to a different app.

Motivation and Context

As documented in issue #519, django does not correctly create the phone model as the model code is in a different app from where the model is assigned to.

How Has This Been Tested?

Migrations were ran. Running makemigrations shows that there are no outstanding model changes.

Types of changes

Checklist:

claudep commented 2 years ago

Could you still reformat the new initial migration so flake8 is happy (line length <= 119)?

codecov[bot] commented 2 years ago

Codecov Report

Merging #527 (8f0704a) into master (c44a422) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #527   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files          60       60           
  Lines        2658     2658           
  Branches      278      278           
=======================================
  Hits         2611     2611           
  Misses         28       28           
  Partials       19       19           
Impacted Files Coverage Δ
two_factor/plugins/phonenumber/models.py 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more