Models are the skeleton of your database tables, all the business operations go in forms/viewsets/serializer.
What you are trying to do here is :
class Check (models.Model):
user_id = models.ForeignKey(Client, on_delete=models.CASCADE)
client = Client.objects.get(pk=1) #change id according to user_id
client_birth = client.birth
client_gender = client.gender
class Client (models.Model):
gender = models.CharField()
birth = models.DateField()
The result would be:
## Client Table ##
id gender birth
1 M 1/1/89
2 F 2/2/90
3 M 3/3/91
## Check Table ##
id user_id
1 1
It wont create anything else in check table.
Your code models should be like this :
class Check (models.Model):
user_id = models.ForeignKey(Client, on_delete=models.CASCADE)
# (Assuming there are other fields in Check model , else theres no use of this)
class Client (models.Model):
gender = models.CharField()
birth = models.DateField()
Then in your custom create/update method you have to write the logic on what you have to check:
user_id = (you get it from request or user input maybe , not sure what your requirements are)
client = Client.objects.get(pk=user_id)
client_birth = client.birth
client_gender = client.gender
# Rest of the code and save/update
In my opinion Check model wont make any sense, it has to go in forms/serializer where you are actually checking before creating or saving it in your DB.