On Mon, Apr 13, 2009 at 8:02 PM, James Bennett <[email protected]> wrote: > user -- they behaved more like normal attributes. At that point > get_profile() could have been refactored into a read-only property, > but there really weren't any pressing API-design reasons for doing so.
Sure; that's mostly what I was curious about--whether get_profile() as an API predated the ORM's current relationship API and was mostly historical, since it mostly seems like duplicate functionality. > That means you can write generic code which, for example, looks up the > profile model and generates a form for it, or which provides generic > support for managing user profiles (I've written this sort of thing, > and found it both extremely easy and extremely handy). Well, you might want to do that for any model, and the admin API provides a more generic approach to managing this sort of task--but OK. It also assumes that there's just one type of profile--I'd think that an app that wants to store information per user would want to have its own model, since expecting the "main" user of the site to add some boilerplate entries to his profile model doesn't seem very nice. The reverse OneToOne mappings mostly scale to this sort of thing cleanly. > Using AUTH_PROFILE_MODULE and get_profile() also helps to clarify to > other people what your code is doing: by now it's such an established > convention that people who look at your applications will immediately > understand what's going on. I don't think "user.get_profile()" is measurably clearer than "user.profile", though I guess it would be if you named your profile class "Teapot". -- Glenn Maynard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
