williamflaherty / pearing

KCSW project
Other
1 stars 0 forks source link

Fixing bugs from updating Django and DRF #20

Closed Mimimiel closed 9 years ago

Mimimiel commented 9 years ago

When we upgraded to Django 1.7 and Django Rest Framework 3.0, I didn't push the corresponding fixes for those upgrades (see issue #11). The following are the most important changes:

  1. Upgrade your packages to Django 1.7.5 and DRF 3.0.
  2. Remove south from your installed packages and from INSTALLED_APPS in your settings.py.
  3. Use Django to make and run migrations (i.e. to update the models and database). For more information on that, please see Django's how-to. In short though, please do not use the manage.py syncdb command anymore and get used to migrate and makemigrations.
  4. :sparkling_heart: The Django and DRF upgrade finally addressed some major pain points I was having with model relationships and nesting. :sparkling_heart: No one but me cares about that currently, but it is going to be so great. What you should care about is that:
    • .object has been replaced with .validated_data when using serializers
    • ModelSerializers need to define a custom create() function instead of using the default. The default create() packaged in ModelSerializers is the replacement for .object previously returning a populated Model object, but the default method calls .create() followed by save() which is very bad. :boom:
danielcash commented 9 years ago

lgtm -- merging and i'll go ahead and add in the 200 status code for success case.

http://i.imgur.com/idHBceh.jpg