Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

0
view does not render // does everything inside if statement but renders another part
Post Body

@csrf_exempt
@login_required
def edit_professor(request):
    is_passing = True
    current_user = request.user
    professors = Professor.objects.filter(user__username=current_user.username)
    professor=None
    updated = False
    if current_user.userprofile.is_member:
        if request.method == 'POST':
            print('POSTING')
            if request.POST.get('action') == 'passing':
                print('passing')
                professor_name = request.POST.get('professor_name')
                professor=professors.get(name=professor_name) 
                print(professor.name)
                return render(request,'dashboard/edit_professor.html',{'is_passing':is_passing,'updated':updated,'professor':professor})

            else: 
                print('not passing')
                is_passing = False
                professor_name = request.POST.get('name')
                professor_name = str(professor_name).lower()
                professor_email = request.POST.get('email')
                professor_phone = request.POST.get('phone')
                professor_focus = request.POST.get('focus')
                try: 
                    professor = Professor.objects.get(name=professor_name)
                    try:
                        professor.user = current_user
                        if professor_name != professor.name:
                            professor.name = str(professor.name).lower()
                        if professor_email != professor.email:
                            professor.email = professor_email
                        if professor_phone != professor.phone:
                            professor.phone = professor_phone
                        if professor_focus != professor.focus:
                            professor.focus = professor_focus
                        professor.save()
                    except Exception:
                        pass
                    else:
                        registered = True
                except ObjectDoesNotExist:
                    return HttpResponse('Professor does not exist')
        else:
            return HttpResponse('PPPPPP')

    else:
        return render(HttpResponseRedirect(reverse('index')))
    return render(request,'dashboard/edit_professor.html',{'is_passing':is_passing,'updated':updated,'professor':professor})

/////////////////////////////////////////////////

/////////////////////////////////////////////////

IS RENDERING THE PART:

return HttpResponse('PPPPPP')

BUT IT SHOULD RENDER:

return render(request,'dashboard/edit_professor.html',{'is_passing':is_passing,'updated':updated,'professor':professor})

Because im sending a post request with data {action: 'passing'}

Author
Account Strength
80%
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
153
Link Karma
134
Comment Karma
19
Profile updated: 5 days ago
Posts updated: 3 weeks ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago