(request)
return render(request, "accounts/merge_profile.html", context=context)
Merge two profiles into one.
Merge two profiles into one.
Merge two profiles into one .
def merge_profile(request):
    """
    Merge two profiles into one.
    """

    user = request.user
    form = forms.MergeProfiles(user=user)

    if request.method == 'POST':
        form = forms.MergeProfiles(user=user, data=request.POST)

        if form.is_valid():
            merged = form.save()
            messages.success(request, "Merged profiles")
            return redirect(reverse('user_profile', kwargs=dict(uid=merged.profile.uid)))

    context = dict(form=form)
    return render(request, "accounts/merge_profile.html", context=context)
def merge_profile ( request ) : user = request . user form = forms . MergeProfiles ( user = user ) if request . method == 'POST' : form = forms . MergeProfiles ( user = user , data = request . POST ) if form . is_valid ( ) : merged = form . save ( ) messages . success ( request , "Merged profiles" ) return redirect ( reverse ( 'user_profile' , kwargs = dict ( uid = merged . profile . uid ) ) ) context = dict ( form = form ) return render ( request , "accounts/merge_profile.html" , context = context )