Exemple #1
0
def retrieve(request):
    try:
        profile = request.user.get_profile()
    except UserProfile.DoesNotExist:
        profile = UserProfile(user=request.user)
        profile.save()
    return profile
def retrieve(request):
        try:
               profile = request.user.get_profile()
        except UserProfile.DoesNotExist:
               profile = UserProfile(user=request.user)
               profile.save()
        return profile
Exemple #3
0
def retrieve(request):
    """ gets the UserProfile instance for a user, creates one if it does not exist """
    try:
        profile = request.user.get_profile()
    except UserProfile.DoesNotExist:
        profile = UserProfile(user=request.user)
        profile.save()
    return profile
Exemple #4
0
def retrieve(request):
    """ gets the UserProfile instance for a user, creates one if it does not exist """
    try:
        profile = request.user.get_profile()
    except UserProfile.DoesNotExist:
        profile = UserProfile(user=request.user)
        profile.save()
    return profile
Exemple #5
0
def retrieve(request):
    '''note that this requires an authenticated user before we try calling it'''
    try:
        profile = request.user.get_profile()
    except UserProfile.DoesNotExist:
        profile = UserProfile(user = request.user)
        profile.save()
    return profile