Is there a query set to compare id of two different model and if id matched i wanna auto fill the html form?

  django, jquery, python

I want to auto-fill my one form when I enter Id then data related to that id is auto fill-in HTML form like Name, Address, Gender, Email, Images, etc.

I am not seeing any errors but the code doesn’t work as expected

Both salary payment model and staff registration model are of Different apps

When I register a staff his/her id and another detail are saved in the database with their unique Id and when I give staff his/her salary I want to auto-fill the HTML form when I enter the id of the particular staff.

If both staff registration id is equal to the id we have typed in salary payment form matched then data related to that id is autofill in HTML form where user can see

This is my salary payment model:-

class SalaryPayment(models.Model):
    Staff_id = models.UUIDField(primary_key=True)
    Staff_Image = models.ImageField(null = True,blank = True)
    Staff_Name = models.CharField(max_length=256)
    Staff_Address = models.CharField(max_length=256)
    Staff_Phone = models.CharField(max_length=15)
    Staff_Profession = models.CharField(max_length=256)
    Gender = models.CharField(max_length=15)
    Citizen_Ship_No = models.CharField(max_length=150)
    Staff_Basic_Salary = models.DecimalField(max_digits=10,decimal_places=2)
    Staff_Extra_Income = models.DecimalField(max_digits=10,decimal_places=2)
    Total = models.DecimalField(max_digits=20,decimal_places=2,default=0.00)
    slug = models.SlugField(unique=True,allow_unicode=True)

This is my Staff registration model:-

class StaffRegistration(models.Model):
    Staff_id = models.UUIDField(primary_key=True,default=uuid.uuid4)
    Staff_Image = models.ImageField(blank = True,null = True)
    Name = models.CharField(max_length=250,null=False)
    Address = models.CharField(max_length=250,null=False)
    Email = models.EmailField(unique=True)
    phone = models.CharField(null = False,blank = False,unique = True,max_length=150)
    Join_Date = models.DateTimeField(auto_now_add=True,blank=False)
    profession = models.CharField(max_length=255,blank=False,default='Teacher')
    Citizen_ship_No = models.CharField(max_length=150,unique=True,blank=True,null=True)
    Gender = models.CharField(default='Male',choices=user_sex,max_length=150)

This is the view where I wrote query set to auto-fill the HTML fields:-

from django.urls import reverse_lazy
from registration.models import StaffRegistration
from django.views import generic
from django.contrib.auth.mixins import LoginRequiredMixin,PermissionRequiredMixin

    class SalaryEnter(generic.CreateView,generic.ListView,LoginRequiredMixin,PermissionRequiredMixin):
        form_class = SalaryPaymentForm
        model = SalaryPayment
        template_name = 'payment/salary.html'
        success_url = reverse_lazy('payments:salist')
        def get(self,request,*args,**Kwargs):
            entered = self.request.GET.get('SID','')
            if entered == StaffRegistration.Staff_id:
                self.result = StaffRegistration.objects.all()
                self.result = StaffRegistration.objects.none()
            return super().get(request,*args,**Kwargs)
        def get_context_data(self,**kwargs):
            return super().get_context_data(results = self.result,**kwargs)

Source: Python Questions