Form post request not sending data to django please help me

i am passing data from edisplay.html to class name called EmailManagement but after inserting data data goes blank even i type it and i fell auto submitted when i type first form because myform appear only first form validation. First condition then only other will display

Second form

Termainal where can see blank value

def EmailManagement(request):
    if request.method == "POST":
        code = request.POST.get('scode_no', '')
        if code:
            userlogin = EmailDb.objects.all().filter(scode = code)
            scode = ''
            for i in userlogin:
                scode += i.scode
            # print(scode)
            if code == scode:
                sem = EmailDb.objects.all().filter(scode = code)
                idv = ''
                for i in sem:
                    idv += str(
                idv = int(idv)
                p = EmailDb.objects.get(id=idv)
                if request.method == 'POST':
                    institution = request.POST.get('institutionf', '')
                    fullname = request.POST.get('fullnamef', '')
                    email = request.POST.get('personalef', '')
                    contact = request.POST.get('contactf', '')
                    position = request.POST.get('positionf', '')
                    uploaded = request.FILES.get('filef', '')
                    p.institution = institution
                    p.fullname = fullname
           = contact
           = email
                    p.position = position
                    p.uploaddata = uploaded
          ['institution', 'fullname', 'contact', 'email', 'position', 'uploaddata'])
                form = pForm()
                return render(request, 'NEC/edisplay.html', {'p': p, 'form': form})
    form = ResultForm()
    return render(request,'NEC/emailmgt.html', {'form': form})


<form hx-post="email" hx-target="body" method="POST" enctype="multipart/form-data">
                        {% csrf_token %}
                        <!-- <input type="text" name="institution" id="institution" placeholder="Institution Name" class="form-control w-50 form-row" value="{{p.institution}}" required>
                        <input type="text" name="fullname" id="fullname" placeholder="Full Name" class="form-control w-50 form-row mt-1" value="{{p.fullname}}" required>
                        <input type="text" name="email" id="contact" placeholder="Personal Email " class="form-control w-50 form-row mt-1" value="{{}}" required>
                        <input type="text" name="contact" id="contact" placeholder="Contact " class="form-control w-50 form-row mt-1" value="{{}}" required>
                        <input type="text" name="position" id="position" placeholder="Position " class="form-control w-50 form-row mt-1" value="{{p.position}}" required>
                        <input class="form-control w-50 form-row mt-1" type="file" id="formFile" name="upload" required> -->
                        <input class="form-check-input" type="checkbox" value="" id="invalidCheck" name='checkbox' required>
                        <label class="form-check-label" for="invalidCheck">
                            Agree to terms and conditions
                        <input class="bg-success text-white mt-1" style="margin-top: 0px;" type="submit" />

class EmailDb(models.Model):
    institution = models.CharField(max_length=300, blank=True, null=True)
    fullname = models.CharField(max_length=50, blank=True, null=True)
    contact = models.CharField(max_length=50,blank=True, null=True)
    email = models.CharField(max_length=300, blank=True, null=True)
    position = models.CharField(max_length=100, blank=True, null=True)
    uploaddata = models.FileField(upload_to='appointment_letter', blank=True, null=True)
    useremail = models.CharField(max_length=100, blank=True, null=True)
    userpassword = models.CharField(max_length=100, blank=True, null=True)
    scode = models.CharField(max_length=200, blank=True, null=True)

    def __str__(self):
        return self.scode

from django import forms

class pForm(forms.Form):
    institutionf = forms.CharField(label="", help_text="", widget=forms.TextInput(attrs={'placeholder': 'Institution Name'}))
    fullnamef = forms.CharField(label="", help_text="", widget=forms.TextInput(attrs={'placeholder': 'Full Name'}))
    personalef = forms.CharField(label="", help_text="", widget=forms.TextInput(attrs={'placeholder': 'Personal Email'}))
    contactf = forms.CharField(label="", help_text="", widget=forms.TextInput(attrs={'placeholder': 'Personal Email'}))
    positionf = forms.CharField(label="", help_text="", widget=forms.TextInput(attrs={'placeholder': 'Contact'}))
    filef = forms.FileField()

I have to go though first form inorder to display second form. help appricated please help me.

blank value - NULL value or empty value

Back to Top