Files
2012-02-21 01:15:00 -05:00

1 line
2.1 KiB
JSON

[{"user_id": 3580, "stars": [], "topic_id": 40445, "date_created": 1309031690.1697519, "message": "(btw.. It is clearly spelled out in the Django docs that the authors aren't fans of NULL for CharFields.. and I'm not entirely in disagreement, but uniqueness constraints on optional values are at obvious odds with that philosophy)", "group_id": 81, "id": 1485431}, {"user_id": 3580, "stars": [], "topic_id": 40445, "date_created": 1309031460.3350241, "message": "I've done some reading and I'm not really thrilled with the solutions I've found.. I've got a number of cases where I prefer NULL to '' in the database. The most significant motivator is when I have UNIQUE constraints on a column.. such that if a value is provided, it ought to be unique. For models with this setup, Django admin is a pain..", "group_id": 81, "id": 1485408}, {"user_id": 3580, "stars": [], "topic_id": 40445, "date_created": 1309031536.859911, "message": "Ideally for me Django admin would convert all CharFields for whom blank=True, null=True from '' to NULL on save. Is there a simple way for me to make that happen without subclasses CharField or creating custom admin forms for each of my models?", "group_id": 81, "id": 1485413}, {"user_id": 32856, "stars": [], "topic_id": 40445, "date_created": 1309035701.3724051, "message": "In a one-off case, I'd probably customize save(), but a cleaner solution is to subclass the field, such as https://code.djangoproject.com/ticket/9590#comment:3", "group_id": 81, "id": 1485709}, {"user_id": 2117, "stars": [], "topic_id": 40445, "date_created": 1309056068.797509, "message": "I've also just bumped into exactly the same problem... I also have some UNIQUE constraints that must be preserved, and was just starting to research the issue. Subclassing for me, I guess...", "group_id": 81, "id": 1486852}, {"user_id": 35238, "stars": [], "topic_id": 40445, "date_created": 1309060892.6716199, "message": "Having similar problem, went with subclassing (http://stackoverflow.com/questions/5015063/nullable-textfield-or-empty-string-in-django-model/5114226#5114226). I guess, a field class like that would be useful as a part of Django core...", "group_id": 81, "id": 1487163}]