mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
16 KiB
JSON
1 line
16 KiB
JSON
[{"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1303936624.882164, "message": "(though as James said, even in that it is far from perfect)", "group_id": 81, "id": 832226}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303936569.728936, "message": "Thanks @ubernostrum. That was what I was feeling. Especially since I'm using django-registration with two backends to support two different types of very different users", "group_id": 81, "id": 832216}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303936121.3563099, "message": "@mrgrouchy I'm having to make auxillary profile models on a project right now because I can't risk one type of of user having the same fields as another type of user.", "group_id": 81, "id": 832085}, {"user_id": 31397, "stars": [], "topic_id": 21696, "date_created": 1303936572.5500009, "message": "@coderanger: thanks. that makes hell lot of sense!", "group_id": 81, "id": 832217}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303935825.33459, "message": "Crazy idea: If you have a Django project with two dramatically different user types, maybe ditch get_profile and go with two profile models.", "group_id": 81, "id": 832018}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303936326.7427399, "message": "Or I have to use lots of select_relateds.", "group_id": 81, "id": 832128}, {"user_id": 3447, "stars": [], "topic_id": 21696, "date_created": 1303936495.513993, "message": "Two types of users isn't a use case get_profile() handles.", "group_id": 81, "id": 832190}, {"user_id": 738, "stars": [], "topic_id": 21696, "date_created": 1303936016.824446, "message": "Its a neat idea, does this happen often though? There is only so much metadata you need to have for a user.", "group_id": 81, "id": 832054}, {"user_id": 1736, "stars": [{"date_created": 1303937534.484072, "user_id": 8}], "topic_id": 21696, "date_created": 1303936152.8256891, "message": "get_profile() is definitely very overused.", "group_id": 81, "id": 832092}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303936270.3089421, "message": "I keep having to do: profile = user.get_profile() and then if profile.role == 'ninja': ninja = Ninjia.objects.get(user=User)", "group_id": 81, "id": 832117}, {"user_id": 3447, "stars": [], "topic_id": 21696, "date_created": 1303936485.6719661, "message": "Yes.", "group_id": 81, "id": 832186}, {"user_id": 3447, "stars": [], "topic_id": 21696, "date_created": 1303936538.2543049, "message": "So if you have multiple user types and multiple profile types associated with them, just roll your own helper to fetch the right profile type for a given user instance.", "group_id": 81, "id": 832209}, {"user_id": 31397, "stars": [], "topic_id": 21696, "date_created": 1303936175.2342801, "message": "Well I wouldn\u2019t ditch it completely, but rather overwrite it so it gets the correct profile(-type). Sometimes it\u2019s handy to just call get_profile :D", "group_id": 81, "id": 832095}, {"user_id": 1736, "stars": [{"date_created": 1303938629.3710859, "user_id": 141}, {"date_created": 1303940037.7067471, "user_id": 209}, {"date_created": 1303951449.9797151, "user_id": 927}], "topic_id": 21696, "date_created": 1303936177.284965, "message": "Most projects should just use normal o2os.", "group_id": 81, "id": 832096}, {"user_id": 1736, "stars": [{"date_created": 1304706969.9312041, "user_id": 1694}], "topic_id": 21696, "date_created": 1303936228.3341401, "message": "@originell The only time it is correct to call get_profile is when you are writing code that has to reflect info from an unknown profile object. It should only be used in highly abstracted code that isn't related to your project anywhere", "group_id": 81, "id": 832112}, {"user_id": 1736, "stars": [{"date_created": 1303939197.0911939, "user_id": 4581}, {"date_created": 1304707001.8872991, "user_id": 1694}], "topic_id": 21696, "date_created": 1303936477.0352099, "message": "@originell No, just do user.myprofile where .myprofile is a normal onetoonefield related", "group_id": 81, "id": 832183}, {"user_id": 1398, "stars": [], "topic_id": 21696, "date_created": 1303936507.681587, "message": "Yes to which one @ubernostrum?", "group_id": 81, "id": 832194}, {"user_id": 3447, "stars": [], "topic_id": 21696, "date_created": 1303936517.372401, "message": "It's optimized for the more common case of one user type with one profile, and can't distinguish multiple profile types if you have them.", "group_id": 81, "id": 832199}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1303936613.397651, "message": "The extra indirection of get_profile is only useful if you are writing code that has to work with _any_ possible profile system", "group_id": 81, "id": 832224}, {"user_id": 31397, "stars": [], "topic_id": 21696, "date_created": 1303936414.8791461, "message": "Mh. I always used get_profile(). Why is it considered better to do a, f.e.: UserProfile.objects.get(user=request.user) ? (If I\u2019m getting this right)", "group_id": 81, "id": 832160}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1303936499.004539, "message": "That is functionally identical to get_profile with one less layer of indirection", "group_id": 81, "id": 832192}, {"user_id": 209, "stars": [], "topic_id": 21696, "date_created": 1303940876.988946, "message": "I can safely say it's not in any of my code.", "group_id": 81, "id": 833206}, {"user_id": 209, "stars": [], "topic_id": 21696, "date_created": 1303940107.172941, "message": "@pydanny yeah, that's pretty crazy. OneToOne fields are so much better. if user.ninja: ...", "group_id": 81, "id": 833085}, {"user_id": 7, "stars": [{"date_created": 1303940880.4535351, "user_id": 209}, {"date_created": 1304021007.5848219, "user_id": 22109}, {"date_created": 1304040358.758517, "user_id": 1736}], "topic_id": 21696, "date_created": 1303940809.239167, "message": "I never use get_profile()", "group_id": 81, "id": 833197}, {"user_id": 7129, "stars": [], "topic_id": 21696, "date_created": 1303940906.295867, "message": "At Playfire we are using over 20 (!) different profile models, all defined with \"user = models.OneToOneField('auth.User', primary=True)\". This spreads write contention and indices across our tablespace and minimises downtime when we need to change these tables. the only drawback is that it requires extra joins in the rare case (in our application anyway) we need to do filtering across a bunch of them.", "group_id": 81, "id": 833210}, {"user_id": 4383, "stars": [], "topic_id": 21696, "date_created": 1303942287.3601079, "message": "My company and I have never been fns of Django's contrib.auth app. We generally don't use it.", "group_id": 81, "id": 833390}, {"user_id": 4383, "stars": [], "topic_id": 21696, "date_created": 1303942694.5131049, "message": "Folks at the company I work for, I should say.", "group_id": 81, "id": 833465}, {"user_id": 31418, "stars": [], "topic_id": 21696, "date_created": 1303945505.403743, "message": "btw, what is preffered now, o2o or FK(unique=True)? I have seen both in different sources, so I was wondering what is actually recommended and why?", "group_id": 81, "id": 833864}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1303946259.752615, "message": "@dgerzo For get_profile(), FK. For what you should actually be doing, o2o.", "group_id": 81, "id": 833978}, {"user_id": 1127, "stars": [], "topic_id": 21696, "date_created": 1303948352.790606, "message": "There is one use for get_profile(): user.profile.user = user; return user.profile; It implies the cache", "group_id": 81, "id": 834208}, {"user_id": 1127, "stars": [], "topic_id": 21696, "date_created": 1303948367.9123771, "message": "Though obviously that should be optimized in Django core and not in get_profile()", "group_id": 81, "id": 834214}, {"user_id": 1, "stars": [], "topic_id": 21696, "date_created": 1303974066.9426179, "message": "For Convore we have a userprofile model that uses a OneToOneField, and then we just do user.profile", "group_id": 81, "id": 837766}, {"user_id": 26595, "stars": [], "topic_id": 21696, "date_created": 1303974038.6848619, "message": "I never use get_profile either. @ianmlewis wondering what you do use at your company then.", "group_id": 81, "id": 837762}, {"user_id": 21387, "stars": [], "topic_id": 21696, "date_created": 1303986297.4395339, "message": "but IMHO, the \"Storing additional information about users\" @ auth docs just confuses the coder, because instead of that he could always just stick with o2o without having to write any setting to use a .get_profile(), that can handle just one kind of profile model.", "group_id": 81, "id": 839042}, {"user_id": 21387, "stars": [], "topic_id": 21696, "date_created": 1303986371.4215441, "message": "the docs should just give examples of o2o models for storing users' data.", "group_id": 81, "id": 839047}, {"user_id": 21387, "stars": [], "topic_id": 21696, "date_created": 1303986158.5772951, "message": "Some weeks ago I had a discussion with people at #django and I got bashed. They said that .get_profile is a standard and should be used.", "group_id": 81, "id": 839029}, {"user_id": 1387, "stars": [], "topic_id": 21696, "date_created": 1303999473.806473, "message": "We created django-staff to handle this kind of thing. It stores different info for staffmembers vs. regular users", "group_id": 81, "id": 841475}, {"user_id": 4383, "stars": [], "topic_id": 21696, "date_created": 1304008045.1603911, "message": "@hvdklauw I created my own auth app which provides a abstract base model that assumes no more than that the user model has a pk. I create a user model for each site. No silly get_profile() or o2o stuff.", "group_id": 81, "id": 843114}, {"user_id": 4383, "stars": [], "topic_id": 21696, "date_created": 1304008179.4803541, "message": "We sometimes get asked by clients to change things about how the user logs in and the auth app is more trouble than it's worth. We only use it for the admin.", "group_id": 81, "id": 843164}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304012801.808558, "message": "This looked to me like a weak point for Django since I started doing it. I guess we all agree it should turn into something more flexible.", "group_id": 81, "id": 844328}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1304015374.281425, "message": "@maraujop Yeah, what I really want to see if the opposite, instead of an indirect layer for getting profiles for a user, have an indirect way to point to the user itself. A UserForeignKey if you will. It would just be a normal FK, but would look up its destination from a config key. That still allows for reusable apps, without forcing you to use auth.User", "group_id": 81, "id": 844947}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304076988.316324, "message": "I can do: User.find('pheze') -> Returns the User or None", "group_id": 81, "id": 854588}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304077027.396328, "message": "It's still more convenient than User.objects.get(username='pheze').get_profile()", "group_id": 81, "id": 854592}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304077056.451988, "message": "+ the .find and .find_profile returns None if user is not found.. The try: except: to check user was really annoyhing", "group_id": 81, "id": 854593}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304077094.2653661, "message": "user = User.find('bleh'); if not user: raise Http404(); print user", "group_id": 81, "id": 854601}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304076976.2135539, "message": "For my project, I hacked a little bit, I've monkey patched User", "group_id": 81, "id": 854587}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304076998.41485, "message": "or User.find_profile('pheze') -> Returns the profile", "group_id": 81, "id": 854589}, {"user_id": 1917, "stars": [], "topic_id": 21696, "date_created": 1304077111.8373251, "message": "(this is just an example)", "group_id": 81, "id": 854602}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304157956.2537351, "message": "@coderanger That is interesting. But what happens with that config key if you have 3 different models for 3 different profiles? The way I have handled different profiles till now, is doing a model that works like a dispatcher somehow.", "group_id": 81, "id": 867131}, {"user_id": 14653, "stars": [{"date_created": 1304212871.0721149, "user_id": 6396}], "topic_id": 21696, "date_created": 1304157972.4749761, "message": "@pheze Monkeypatching User makes me shudder", "group_id": 81, "id": 867133}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304158108.114507, "message": "didn't @ericflo talk about the auth app in his talk \"why Django sucks?\" I think the problem is not get_profile, is the necessity of improving contrib.auth", "group_id": 81, "id": 867154}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1304180926.363483, "message": "@maraujop All three profile modules would have a ForeignKey on to your user model on them. (they wouldn't need UserForeignKey for same reason you wouldn't use get_profile in that situation).", "group_id": 81, "id": 869197}, {"user_id": 14653, "stars": [{"date_created": 1304283143.279551, "user_id": 18694}], "topic_id": 21696, "date_created": 1304262973.455579, "message": "@coderanger Ok, I guess what we would all like is to be able to modify User model a little bit without having weird issues or strange situations.", "group_id": 81, "id": 875842}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304263038.3405521, "message": "That would let us add some interesting methods that would make the code more elegant and easy to follow, without loosing the power of the built-in Auth model. Having a powerful Auth system that is flexible turns very useful :)", "group_id": 81, "id": 875853}, {"user_id": 1736, "stars": [], "topic_id": 21696, "date_created": 1304274686.4434021, "message": "@maraujop Via the magic of duck typing and reflection you can still do that. Django could even provide auth.User as an abstract model. The key is that you control the User model entirely in the end.", "group_id": 81, "id": 877108}, {"user_id": 5296, "stars": [], "topic_id": 21696, "date_created": 1304313563.5224471, "message": "the app-loading refactor lets you subclass the \"contrib.auth\" app and replace its models", "group_id": 81, "id": 880489}, {"user_id": 25337, "stars": [], "topic_id": 21696, "date_created": 1304328768.7450211, "message": "@arthurk Is that specific to contrib.auth, or can you replace any app's models?", "group_id": 81, "id": 881672}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304336991.8204119, "message": "@coderanger there are many hacks available, but not many people take the risks. In the end if someone needs a lot more power in User model ends up coding their auth app system. We all know this involves loosing some of the pony magic.", "group_id": 81, "id": 882198}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304337277.6181209, "message": "@arthurk @danfairs There is a django app called django-primate https://github.com/aino/django-primate that lets you monkeypatch User model using south. I find this very scary :)", "group_id": 81, "id": 882234}, {"user_id": 25337, "stars": [], "topic_id": 21696, "date_created": 1304412268.9568441, "message": "Slightly OT: I also have an experimental project, https://github.com/danfairs/django-dfk - it lets you create deferred, named foreign keys - the idea being that the system integrator can 'repoint' those foreign keys as they integrate system components.", "group_id": 81, "id": 895508}, {"user_id": 25337, "stars": [], "topic_id": 21696, "date_created": 1304412146.6616409, "message": "@maraujop Ouch - monkeypatches always lead to pain...", "group_id": 81, "id": 895477}, {"user_id": 5296, "stars": [], "topic_id": 21696, "date_created": 1304428283.4760001, "message": "@danfairs no, you can replacy any apps models", "group_id": 81, "id": 897668}, {"user_id": 14653, "stars": [], "topic_id": 21696, "date_created": 1304427395.6996379, "message": "@danfairs I couldn't sum it up better :)", "group_id": 81, "id": 897459}, {"user_id": 25337, "stars": [], "topic_id": 21696, "date_created": 1304434353.7118139, "message": "@arthurk Mm - nice. Definitely looking forward to seeing that land.", "group_id": 81, "id": 898718}] |