Repository: learningequality/kolibri

Issue:
0.7.2 Upgrade to 0.10.0
### Observed behavior
Login as admin at the log in page after the upgrade from 0.7.2 to 0.10.0b2 will have a javascript errors and the login page freeze. After I reload the page I logged in as admin and redirected at the profile page.

### Expected behavior
Log in page should work properly when I log in.

### Errors and logs
![screen shot 2018-06-15 at 4 07 09 pm](https://user-images.githubusercontent.com/8663934/41457822-78b75392-70b7-11e8-969e-6e4a896ecf9e.png)

### Steps to reproduce
* Install the 0.7.2
* Copy the [0.7.2 Kolibri sample data](https://drive.google.com/open?id=1HAJcFr7Yhqj2C8gE88-4gMR7sNJtQiuh) at the `.kolibri`
* Upgrade to 0.10.0b2
* Log in at the log in page

### Context

Tell us about your environment, including:
 * Kolibri version: 0.10.0b2
 * Operating system: Windows 10
 * Browser: firefox


device and facility not shown, when upgrading kolibri 0.7.2 to 0.11.0a4 
<!--
Instructions:
 * Fill out the sections below, replace …'s with information about your issue
 * Use the 'preview' function above this text box to verify formatting before submitting
-->

### Observed behaviour
Observe when I upgrade the kolibri 0.7.2 to 0.11.0a4, the device and facility not shown up.

![admin-role](https://user-images.githubusercontent.com/38421180/42670191-f160a50c-868b-11e8-857b-cedb9ceafda2.png)
![device and facility are not availble](https://user-images.githubusercontent.com/38421180/42670195-f5bb4cf6-868b-11e8-9f7a-835997efbc3c.png)


<!--
Description of the behavior that was observed, including screenshots or other references when applicable
-->



### Expected behaviour
Must show the device and facility
<!--
Description of what behavior was expected but did not occur
-->


### Context
<!--
Tell us about your environment, including:
 * Kolibri version
 * Operating system
 * Browser
-->
upgrade to kolibri 0.7.2 to 0.11.0a4
Windows 7
firefox 61.0.1



Discussion:
see also #3806, #3807
Is it because assets are cached from the previous release? (can be tested by refreshing SHIFT+F5 or similar, depending on your platform)
does this mean that you got logged out?
@indirectlylit no, when I login as a superuser/admin, I didn't seen the device and facility. 
possibly-related issues: #3805, #3806
@mrpau-julius can you confirm that the bug disappears the second time you start kolibri, after the migration?
I.E.:
- first time you run it, it migrates the data and this bug appear
- second time you run it, nothing is migrated and device and facility are shown.

Resolving patch:
diff --git a/kolibri/utils/cli.py b/kolibri/utils/cli.py
--- a/kolibri/utils/cli.py
+++ b/kolibri/utils/cli.py
@@ -146,6 +146,9 @@ def initialize(debug=False):
         version = version.strip() if version else ""
         change_version = kolibri.__version__ != version
         if change_version:
+            # dbbackup will load settings.INSTALLED_APPS.
+            # we need to ensure plugins are correct in conf.config before
+            enable_default_plugins()
             # Version changed, make a backup no matter what.
             from kolibri.core.deviceadmin.utils import dbbackup
             try:
@@ -156,7 +159,6 @@ def initialize(debug=False):
                 logger.warning(
                     "Skipped automatic database backup, not compatible with "
                     "this DB engine.")
-            enable_default_plugins()
 
         django.setup()
 


Test patch: