May be better way to use ``OneToOneField`` with proper ``related_name`` like "profile" for example. Than profile can be accessed very simple ``user.pofile``. and its creation machinery leave to profile app author?
On Jul 2, 12:38 pm, David Danier <[EMAIL PROTECTED]> wrote: > This basically started as a ticket suggesting adding some way to create > a default profile for users which don't have one, moving the need to > catch DoesNotExist-exceptions out of the applications using get_profile(). > ->http://code.djangoproject.com/ticket/7584 > > julien did suggest some alternatives, which all bring some drawbacks > with them and finally closed the ticket, as #7592 got closed, too. After > some discussion he suggested bringing the topic up here. > > My current idea is to add the possibility to provide a > get_for_user()-method in the profile manager, this would fix #7584, > #7592 and even #7400...and would possible add room for more ideas, hence > make the whole get_profile()-stuff more flexible. > Patch:http://code.djangoproject.com/attachment/ticket/7584/django-profile-m... > > So, about the alternatives: > > 1. Use signals (#7584, comment:1) > Might work, but does not support on demand creation of profiles for > legacy-users. There may be more use-cases where post_save is not enough. > Still need to catch the exception, as you can't guarantee the existence > of a profile. > > 2. Importing AUTH_PROFILE_MODULE yourself (#7592) > Not really possible, think about templates for example. Even if only > needed in views this duplicates code. > > 3. Own profile-module with appropriate manager (#7584, comment:3) > Like importing AUTH_PROFILE_MODULE yourself, but with cleaner code. > Still no easy support in templates. Does not work if application needs > to be reusable (on some other website with different profiles). > > 4. Overwrite get() on profile-manager (#7584, comment:4) > Possible, but seems rather hackish. Additionally nothing someone new to > django might do or want to do. > > So is there any reason not to support creating profiles on demand? The > patch is only three new lines and should not cause any trouble I think. > Of course docs are missing so far. > > Greetings, David Danier --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
