mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
2.8 KiB
JSON
1 line
2.8 KiB
JSON
[{"user_id": 1147, "stars": [{"date_created": 1304006011.856318, "user_id": 2588}], "topic_id": 21819, "date_created": 1304005931.6355519, "message": "IMO, signals remind me of triggers. In both cases they are \"hidden\" pieces of code that can't be easily spotted unless you comment it very well. I generally prefer to override the save() unless it's in a package that I can't/shouldn't.", "group_id": 81, "id": 842681}, {"user_id": 3580, "stars": [], "topic_id": 21819, "date_created": 1304005573.06288, "message": "I've been wondering what the cleanest way to do this stuff is.. In today's case I've got this Person class (abstract base class model) that has a gender property.. I want to set the person's avatar to the correct female/male one during save.. Should I put something in save() and make sure that the call chain is respected, or use signals?", "group_id": 81, "id": 842606}, {"user_id": 3580, "stars": [], "topic_id": 21819, "date_created": 1304005609.492187, "message": "I tried using signals quickly but they don't appear to fire for base classes when you save the sub.. so presumably I'd have to hook them up on all of the subs, which seems prone to error", "group_id": 81, "id": 842613}, {"user_id": 3580, "stars": [{"date_created": 1304439175.5212829, "user_id": 1296}], "topic_id": 21819, "date_created": 1304006034.3881021, "message": "That makes sense... they struck me as tools that make more sense for ideas that the model shouldn't be aware of (cache eviction, etc)", "group_id": 81, "id": 842702}, {"user_id": 1127, "stars": [], "topic_id": 21819, "date_created": 1304023283.07621, "message": "For example, our instance.update() method fires off a post_save", "group_id": 81, "id": 847005}, {"user_id": 1127, "stars": [{"date_created": 1304056249.522949, "user_id": 14309}], "topic_id": 21819, "date_created": 1304023270.5816679, "message": "It'd be nice if Model's had an abstract {post,pre}_{save,delete} signal already built in that you could just override, but I highly recommend signals over hooking def save(). There's huge benefits when you get into a larger codebase and theres other potential ways post_save could happen", "group_id": 81, "id": 847002}, {"user_id": 927, "stars": [], "topic_id": 21819, "date_created": 1304035723.53248, "message": "As an aside, there are many people who would say you're modeling gender too narrowly: http://www.sarahmei.com/blog/2010/11/26/disalienation/", "group_id": 81, "id": 848785}, {"user_id": 3580, "stars": [], "topic_id": 21819, "date_created": 1304355876.4970961, "message": "@acdha That's a very fair point, and we actually do have a free text component to it in our system... but our system is medical, so the F/M decision determines which fields in some cases are displayed and affects some workflows... It's not really a field for personal gender identity", "group_id": 81, "id": 885874}] |