Example #1
0
def edit_profile(request):
    """
    Main profile view that the user first sees. Ultimately generates the
    following in data_dict:

    :profile_config:    A dictionary of profile units
    :empty_display_names: A list of ProfileUnits that hasn't been made
    """

    user = request.user

    user.update_profile_completion()

    manager = BaseProfileUnitManager(order=[
        'summary',
        'name',
        'employmenthistory',
        'education',
        #'militaryservice',
        'volunteerhistory',
        #'license',
        #'secondaryemail',
        #'website',
        'endorsementinvitation',
        'address'
    ])

    profile_config = manager.displayed_units(user.profileunits_set.all())

    empty_units = [model for model in ProfileUnits.__subclasses__()]

    for units in profile_config.itervalues():
        if units[0].__class__ in empty_units:
            del empty_units[empty_units.index(units[0].__class__)]

    empty_names = [model.get_verbose_class() for model in empty_units]
    empty_display_names = []
    for name in empty_names:
        name_with_space = re.sub(r"(\w)([A-Z])", r"\1 \2", name)
        empty_display_names.append(name_with_space)

    data_dict = {
        'profile_config': profile_config,
        'unit_names': empty_display_names,
        'user': user,
        'view_name': 'My Profile'
    }

    return render_to_response('myprofile/edit_profile.html', data_dict,
                              RequestContext(request))
Example #2
0
def edit_profile(request):
    """
    Main profile view that the user first sees. Ultimately generates the
    following in data_dict:

    :profile_config:    A dictionary of profile units
    :empty_display_names: A list of ProfileUnits that hasn't been made
    """

    user = request.user

    user.update_profile_completion()

    manager = BaseProfileUnitManager(
        order=[
            "summary",
            "name",
            "employmenthistory",
            "education",
            "militaryservice",
            "volunteerhistory",
            "license",
            "secondaryemail",
            "website",
            "address",
        ]
    )
    profile_config = manager.displayed_units(user.profileunits_set.all())

    empty_units = [model for model in ProfileUnits.__subclasses__()]

    for units in profile_config.itervalues():
        if units[0].__class__ in empty_units:
            del empty_units[empty_units.index(units[0].__class__)]

    empty_names = [model.get_verbose_class() for model in empty_units]
    empty_display_names = []
    for name in empty_names:
        name_with_space = re.sub(r"(\w)([A-Z])", r"\1 \2", name)
        empty_display_names.append(name_with_space)

    data_dict = {
        "profile_config": profile_config,
        "unit_names": empty_display_names,
        "user": user,
        "view_name": "My Profile",
    }

    return render_to_response("myprofile/edit_profile.html", data_dict, RequestContext(request))
Example #3
0
def edit_profile(request):
    """
    Main profile view that the user first sees. Ultimately generates the
    following in data_dict:

    :profile_config:    A dictionary of profile units
    :empty_display_names: A list of ProfileUnits that hasn't been made
    """

    user = request.user

    user.update_profile_completion()

    manager = BaseProfileUnitManager(order=['summary',
                                            'name',
                                            'employmenthistory',
                                            'education',
                                            #'militaryservice',
                                            'volunteerhistory',
                                            #'license',
                                            #'secondaryemail',
                                            #'website',
                                            'endorsementinvitation',
                                            'address'])
    
    
    profile_config = manager.displayed_units(user.profileunits_set.all())

    empty_units = [model for model in ProfileUnits.__subclasses__()]
    
    
        
    for units in profile_config.itervalues():
        if units[0].__class__ in empty_units:
            del empty_units[empty_units.index(units[0].__class__)]

    empty_names = [model.get_verbose_class() for model in empty_units]
    empty_display_names = []
    for name in empty_names:
        name_with_space = re.sub(r"(\w)([A-Z])", r"\1 \2", name)
        empty_display_names.append(name_with_space)

    data_dict = {'profile_config': profile_config,
                 'unit_names': empty_display_names,
                 'user': user,
                 'view_name': 'My Profile'}

    return render_to_response('myprofile/edit_profile.html', data_dict,
                              RequestContext(request))
Example #4
0
def edit_profile(request):
    """
    Main profile view that the user first sees. Ultimately generates the
    following in data_dict:

    :profile_config:    A dictionary of profile units
    :empty_display_names: A list of ProfileUnits that hasn't been made
    """

    user = request.user

    user.update_profile_completion()

    manager = BaseProfileUnitManager(order=['social','basicinfo','skill','experience','education'])
    

    profile_config = manager.displayed_units(user.profileunits_set.all())
    empty_units = [model for model in ProfileUnits.__subclasses__()]

    for units in profile_config.iteritems():
        if units[0].__class__ in empty_units:
            del empty_units[empty_units.index(units[0].__class__)]

    
    empty_names = [model.get_verbose_class() for model in empty_units]
    empty_display_names = []
    for name in empty_names:
        name_with_space = re.sub(r"(\w)([A-Z])", r"\1 \2", name)
        empty_display_names.append(name_with_space)

    data_dict = {'profile_config': profile_config,
                 'unit_names': empty_display_names,
                 'user': user,
                 'view_name': 'My Profile',
                 'can_edit':True,
                 }

    return render_to_response('myprofile/edit_profile.html', data_dict,
                              RequestContext(request))
Example #5
0
def view_talent(request,slug):
    # try:

    # if "next" in slug:
    #     the_user = request.REQUEST.get('user')
    #     user = User.objects.all()
    #     the_user = get_next_or_prev(user, the_user, 'next')

    User.objects.all().order_by('email')
    if "next" in slug or "prev" in slug:
        print slug
        the_user = request.REQUEST.get('user')
        user = User.objects.all()
        the_user = get_next_or_prev(user, the_user, slug)
    if "myprofile" in slug:
        the_user = request.user

    # elif "prev" in slug:
    #     the_user = request.REQUEST.get('user')
    #     user = User.objects.all()
    #     the_user = get_next_or_prev(user, the_user, slug)


    else:
        BI = Basicinfo.objects.get(slug=slug)
        PI = ProfileUnits.objects.get(id=BI.id)
        the_user = User.objects.get(id=PI.user_id)

        
    manager = BaseProfileUnitManager(order=['social','basicinfo','skill','experience','education'])

    print manager

    profile_config = manager.displayed_units(the_user.profileunits_set.all())

    empty_units = [model for model in ProfileUnits.__subclasses__()]
    
    for units in profile_config.iteritems():
        if units[0].__class__ in empty_units:
            del empty_units[empty_units.index(units[0].__class__)]

    
    empty_names = [model.get_verbose_class() for model in empty_units]
    empty_display_names = []
    for name in empty_names:
        name_with_space = re.sub(r"(\w)([A-Z])", r"\1 \2", name)
        empty_display_names.append(name_with_space)
    
    user_skill = Skill.objects.filter(user=the_user)

    # user.is_authenticated = True

    data_dict = {'profile_config': profile_config,
                 'unit_names': empty_display_names,
                 'the_user': the_user,
                 'user': request.user,
                 'can_edit': False,
                 'view_name': 'Profile',
                 'user_skill':user_skill,
                  }

    return render_to_response('myprofile/edit_profile.html', data_dict,
                              RequestContext(request))