Browse Source

Document changes regarding migrations

This commit updates the Getting started guide and highlights the upgrade
path for Oscar 0.8.
master
Maik Hoepfel 11 years ago
parent
commit
5eafeca2f2
2 changed files with 83 additions and 22 deletions
  1. 28
    10
      docs/source/internals/getting_started.rst
  2. 55
    12
      docs/source/releases/v0.8.rst

+ 28
- 10
docs/source/internals/getting_started.rst View File

@@ -84,7 +84,6 @@ and append Oscar's core apps:
84 84
         'django.contrib.staticfiles',
85 85
         'django.contrib.flatpages',
86 86
         ...
87
-        'south',
88 87
         'compressor',
89 88
     ] + get_core_apps()
90 89
 
@@ -107,21 +106,16 @@ More info about installing ``flatpages`` is in the `Django docs`_.
107 106
 
108 107
 Next, add ``oscar.apps.basket.middleware.BasketMiddleware`` and
109 108
 ``django.contrib.flatpages.middleware.FlatpageFallbackMiddleware`` to
110
-your ``MIDDLEWARE_CLASSES`` setting. If you're running on Django 1.5, it is
111
-also recommended to use ``django.middleware.transaction.TransactionMiddleware``:
109
+your ``MIDDLEWARE_CLASSES`` setting.
112 110
 
113 111
 .. code-block:: django
114 112
 
115 113
     MIDDLEWARE_CLASSES = (
116 114
         ...
117 115
         'oscar.apps.basket.middleware.BasketMiddleware',
118
-        'django.middleware.transaction.TransactionMiddleware',  # Django 1.5 only
119 116
         'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
120 117
     )
121 118
 
122
-If you're running Django 1.6 or above, you should enable ``ATOMIC_REQUESTS``
123
-instead (see database settings above).
124
-
125 119
 Set your auth backends to:
126 120
 
127 121
 .. code-block:: django
@@ -237,7 +231,7 @@ Check your database settings. A quick way to get started is to use SQLite:
237 231
             'PASSWORD': '',
238 232
             'HOST': '',
239 233
             'PORT': '',
240
-            'ATOMIC_REQUESTS': True,  # Django 1.6+
234
+            'ATOMIC_REQUESTS': True,
241 235
         }
242 236
     }
243 237
 
@@ -255,8 +249,32 @@ Then create the database and the shop should be browsable:
255 249
 You should now have an empty, but running Oscar install that you can browse at
256 250
 http://localhost:8000.
257 251
 
258
-Fixtures
259
-========
252
+Migrations
253
+----------
254
+
255
+Oscar ships with two sets of migrations. If you're running Django 1.7, you
256
+don't need to do anything; Django's migration framework will detect them
257
+automatically and will do the right thing.
258
+If you're running Django 1.6, you need to install `South`_::
259
+
260
+.. code-block:: bash
261
+
262
+    $ pip install South
263
+
264
+And you need to add it to your installed apps:
265
+
266
+.. code-block:: django
267
+
268
+    INSTALLED_APPS = [
269
+        ...
270
+        'south',
271
+    ] + get_core_apps()
272
+
273
+.. _South: http://south.readthedocs.org/en/latest/
274
+
275
+
276
+Initial data
277
+============
260 278
 
261 279
 The default checkout process requires a shipping address with a country.  Oscar
262 280
 uses a model for countries with flags that indicate which are valid shipping

+ 55
- 12
docs/source/releases/v0.8.rst View File

@@ -81,6 +81,17 @@ has been altered to be:
81 81
 Some properties and method names have also been updated to the new naming. The
82 82
 old ones will throw a deprecation warning.
83 83
 
84
+Django 1.7 support
85
+------------------
86
+
87
+Oscar 0.8 comes with support for Django 1.7 out of the box. The app refactor
88
+and the new migration framework are both great improvements to Django. Oscar
89
+now ships with sets of migrations both for South and the new native
90
+migrations framework.
91
+Unfortunately, the changes in Django required a few breaking changes when
92
+upgrading Oscar both for users staying on Django 1.6 and for users upgrading to
93
+Django 1.7 at the same time.
94
+
84 95
 Reworked shipping app
85 96
 ~~~~~~~~~~~~~~~~~~~~~
86 97
 
@@ -205,12 +216,44 @@ Minor changes
205 216
   populate the country databases. It replaces the ``countries.json`` fixture.
206 217
   The command relies on the ``pycountry`` library being installed.
207 218
 
219
+* It is now possible to use product attributes to add a relation to arbitrary
220
+  model instances. There was some (presumably broken) support for it before,
221
+  but you should now be able to use product attributes of type ``entity`` as
222
+  expected. There's currently no frontend or dashboard support for it, as there
223
+  is no good default behaviour.
224
+
208 225
 .. _incompatible_changes_in_0.8:
209 226
 
210 227
 Backwards incompatible changes in 0.8
211 228
 -------------------------------------
212 229
 
213
-.. _incompatible_shipping_changes_in_0.8:
230
+Migrations
231
+~~~~~~~~~~
232
+
233
+* South is not a dependency of Oscar anymore: This means it won't get installed
234
+  automatically when you install Oscar. If you are on Django 1.6 and want to
235
+  use South, you will need to explicitly install it and add it to your
236
+  requirements.
237
+* Only South >= 1.0 is supported: South 1.0 is a backwards compatible release
238
+  explicitly released to help with the upgrade path to Django 1.7. Please make
239
+  sure you update accordingly if you intend to keep using South. Older versions
240
+  of South will look in the wrong directories and will break with this Oscar
241
+  release.
242
+* Rename your South ``migrations`` directories: To avoid
243
+  clashes between Django's migrations and South's migrations, you should rename
244
+  all your South migrations directories (including those of forked Oscar apps)
245
+  to ``south_migrations``. South 1.0 will check those first before falling back
246
+  to ``migrations``.
247
+* Upgrading to new-style migrations: If you're upgrading to Django 1.7, you
248
+  will need to follow the `instructions to upgrade from South`_ for your own
249
+  apps. For any forked Oscar apps, you will need to copy Oscar's initial
250
+  migrations into your emptied ``migrations`` directory first, because Oscar's
251
+  set of migrations depend on each other. You can then create migrations for
252
+  your changes by calling ``./manage.py makemigrations``. Django should
253
+  detect that the database layout already matches the state of migrations; so
254
+  a call to ``migrate`` should fake the migrations.
255
+
256
+.. _instructions to upgrade from South: https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south
214 257
 
215 258
 Product structure
216 259
 ~~~~~~~~~~~~~~~~~
@@ -237,6 +280,8 @@ The following methods and properties have been deprecated:
237 280
 * ``Strategy.select_variant_stockrecords`` - Use
238 281
   ``select_children_stockrecords`` instead.
239 282
 
283
+.. _incompatible_shipping_changes_in_0.8:
284
+
240 285
 Shipping
241 286
 ~~~~~~~~
242 287
 
@@ -378,11 +423,11 @@ Misc
378 423
   trivial ``ProductAttribute.get_validator`` and the unused
379 424
   ``ProductAttribute.is_value_valid`` methods have been removed.
380 425
 
381
-* It is now possible to use product attributes to add a relation to arbitrary
382
-  model instances. There was some (presumably broken) support for it before,
383
-  but you should now be able to use product attributes of type ``entity`` as
384
-  expected. There's currently no frontend or dashboard support for it, as there
385
-  is no good default behaviour.
426
+* The ``RangeProductFileUpload`` model has been moved from the ranges
427
+  dashboard app to the offers app. The migrations that have been naively
428
+  drop and re-create the model; any data is lost! This is probably not an
429
+  issue, as the model is only used while an range upload is in progress. If
430
+  you need to keep the data, ensure you migrate it across.
386 431
 
387 432
 .. _rewritten: https://github.com/tangentlabs/django-oscar/commit/d8b4dbfed17be90846ea4bc47b5f7b39ad944c24
388 433
 
@@ -451,13 +496,11 @@ Migrations
451 496
     Please double-check it's outcome and make sure to do something similar
452 497
     if you have forked the catalogue app.
453 498
 
454
-.. warning::
499
+.. note::
455 500
 
456
-    The ``RangeProductFileUpload`` model has been moved from the ranges
457
-    dashboard app to the offers app. The migrations that have been naively
458
-    drop and re-create the model; any data is lost! This is probably not an
459
-    issue, as the model is only used while an range upload is in progress. If
460
-    you need to keep the data, ensure you migrate it across.
501
+    The migration numbers below refer to the numbers of the South migrations.
502
+    Oscar 0.8 ships with a set of new initial migrations for Django's new
503
+    native migrations framework. They include all the changes detailed below.
461 504
 
462 505
 .. note::
463 506
 

Loading…
Cancel
Save