

@login_required
def register(request):
    context = {
        
    }
    template = 'contest/register.html'
    context['form'] = ProfileForm()
    if (request.method == 'POST'):
        form = ProfileForm(request.POST)
        if form.is_valid():
            profile = form.save(commit=False)
            profile.user = request.user
            if (models.Profile.objects.filter(user=profile.user, contest=profile.contest).count() == 0):
                profile.save()
                context['successful_registration'] = profile.user
            return redirect('contest', cpk=profile.contest.pk)
        else:
            template['form'] = form
    return render(request, template, context)

dataset/ETHPy150Open theSage21/openJudge/openjudge/contest/views.py register/VarMisuse@148/179 `context`->`template`