mozilla/affiliates — pull request #165 by Osmose (2014-03-06 19:26:29+00:00)
Title: Updated data model

This PR creates a new data model for the site and migrates the old data to the new models.

The general idea is that the "Link" model will represent all generated banners, and will have little to no knowledge of the banner it came from. This lets us avoid the problem of maintaining a link to the banner that generated the link when we have multiple types of banners (text banners, image banners, banners with JS code). This should also let us avoid having to change banner URLs again if the set of available banners change, since links don't need that info.

In addition, django-mptt is used for categories as it's an easier interface and has some useful functions even though we're currently limiting it to two categories deep.

The migrations in 7cb92fb are custom and need to be closely reviewed. I've run them on the dataset from affiliates-dev and they seem to work fine (let me know if you want a copy of the data to test on for yourself). In particular they preserve the FKs from the old banners in order to support current Affiliate banner URLs when the URLs change.

The PR directly following this will remove the old data models. Because this involves removing the `badges` app, we want to have this set of commits merged first on the dev server so that the migrations run before the app disappears. On stage and prod, we'll have to push this commit, let the deploy happen, and then push the later commit once it's done. It's janky, but I can't find a better way to remove apps with migrations on the server.