{"action":"created","issue":{"url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/31","repository_url":"https://api.github.com/repos/zlorf/django-dbsettings","labels_url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/31/comments","events_url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/31/events","html_url":"https://github.com/zlorf/django-dbsettings/issues/31","id":150556049,"number":31,"title":"Choice settings?","user":{"login":"etanter","id":1315554,"avatar_url":"https://avatars.githubusercontent.com/u/1315554?v=3","gravatar_id":"","url":"https://api.github.com/users/etanter","html_url":"https://github.com/etanter","followers_url":"https://api.github.com/users/etanter/followers","following_url":"https://api.github.com/users/etanter/following{/other_user}","gists_url":"https://api.github.com/users/etanter/gists{/gist_id}","starred_url":"https://api.github.com/users/etanter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etanter/subscriptions","organizations_url":"https://api.github.com/users/etanter/orgs","repos_url":"https://api.github.com/users/etanter/repos","events_url":"https://api.github.com/users/etanter/events{/privacy}","received_events_url":"https://api.github.com/users/etanter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-23T13:35:24Z","updated_at":"2016-04-29T20:27:39Z","closed_at":null,"body":"Hi,\r\n\r\nMany of the settings in my current application (which does not use db settings yet!) are choices, eg:\r\n```\r\nFOO_CHOICES = (\r\n    (u'OK', 'Approved'),\r\n    (u'FAIL', 'Rejected'),\r\n)\r\n```\r\nI don't see any choice-like setting in the value types. I understand that this might be because there is no obvious mapping to primitive values to put in the database.\r\n\r\nThe most crazy solution I can think of is to use a String setting with the content `\"((u'OK', 'Approved'), (u'FAIL', 'Rejected'),)\"` and then use `eval` to get the dictionary back. This is of course a bit violent and risky.\r\n\r\nWhat would you recommend?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/comments/215872028","html_url":"https://github.com/zlorf/django-dbsettings/issues/31#issuecomment-215872028","issue_url":"https://api.github.com/repos/zlorf/django-dbsettings/issues/31","id":215872028,"user":{"login":"etanter","id":1315554,"avatar_url":"https://avatars.githubusercontent.com/u/1315554?v=3","gravatar_id":"","url":"https://api.github.com/users/etanter","html_url":"https://github.com/etanter","followers_url":"https://api.github.com/users/etanter/followers","following_url":"https://api.github.com/users/etanter/following{/other_user}","gists_url":"https://api.github.com/users/etanter/gists{/gist_id}","starred_url":"https://api.github.com/users/etanter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etanter/subscriptions","organizations_url":"https://api.github.com/users/etanter/orgs","repos_url":"https://api.github.com/users/etanter/repos","events_url":"https://api.github.com/users/etanter/events{/privacy}","received_events_url":"https://api.github.com/users/etanter/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T20:27:39Z","updated_at":"2016-04-29T20:27:39Z","body":"That's not what I'm after, unfortunately. What you're mentioning is for \"a setting that is a choice\", while in my case it's \"a choice that is a setting\". \r\n\r\nMore precisely, my django app is in fact a mini-product line, and some customization are \"bootstrap-time\" settings like, things set in settings.py, and choices or defaults used in a model field. \r\neg.\r\n```\r\nclass MyModel ...\r\n   foo = Field....(...choice=<get this from a setting!>)\r\n```\r\nAfter much fighting I managed to implement what I needed, which supports a \"bootstrap-time\" use of your framework through a direct DB access API (can't use models, because some of these settings must be accessed during the initial execution of settings.py even).\r\n\r\nIf you are interested I can describe more what I did and you can consider whether that's a use case you're interested in supporting (and you can surely come up with a better design for it). \r\n\r\nThanks!"}}