mozilla / django-product-details

Product and locale details for Mozilla products
https://product-details.mozilla.org/1.0/
BSD 3-Clause "New" or "Revised" License
27 stars 22 forks source link

Database backend that stores semantic data (locales as a table, versions as a table, etc.) #53

Open Osmose opened 8 years ago

Osmose commented 8 years ago

It's a rather common need to want to use the list of locales in product_details as the choices for a locale field (let's call this a LocaleField). Less common but still useful would be a similar thing for versions. There are problems around this:

I propose that the database backend should have a locales table and a version table, and models wanting to have a LocaleField can have a ForeignKey to the product_details tables. I think this would avoid all the weirdness around choices.

pmclanahan commented 8 years ago

Interesting. One thing I'll point out is that there is already product-details data (up-to-date as of the date of library version release) included in the package on PyPI. There is also a migration that will pre-load your DB table with said data so that you don't need an internet connection. I'd also recommend against using database-based product_details during test runs. The default config has the aforementioned data already.

We could provide a LocaleField class that has that all setup w/o need of a different DB schema, and that would work regardless of the data storage backend. I feel like denying the use of such a field to projects that don't want or need the product_details data in the DB isn't a good thing. I could be convinced otherwise though if others need this.