Exemplo n.º 1
0
def profile_list(request, public_profile_field=None,
                 template_name='profiles/profile_list.html', **kwargs):

    profile_model = utils.get_profile_model()
    queryset = profile_model._default_manager.all()
    if public_profile_field is not None:
        queryset = queryset.filter(**{ public_profile_field: True })
    kwargs['queryset'] = queryset
    return object_list(request, template_name=template_name, **kwargs)
Exemplo n.º 2
0
 def get_form_class(self, request):
     return utils.get_profile_model().registration_form
Exemplo n.º 3
0
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin

from profile import utils

# add profile inline to user admin
profile_model = utils.get_profile_model()

if profile_model:
    # setup profile inline
    class ProfileInline(admin.StackedInline):
        model = profile_model

    class UserAdmin(UserAdmin):
        inlines = [
            ProfileInline,
        ]

    # Unregister default django User admin 
    admin.site.unregister(User)

    # Register our customized User admin 
    admin.site.register(User, UserAdmin)
Exemplo n.º 4
0
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured

from profile import utils
    
auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', None)
if not auth_profile_module:
    raise ImproperlyConfigured("You must provide an AUTH_PROFILE_MODULE setting.")
   
# connect profile property to user
#profile_model = utils.get_profile_model()
User.profile = utils.get_profile_model()
#User.profile = property(lambda u: profile_model.objects.get_or_create(user=u)[0])