I’m building models for a project in DJANGO 4, but I got stuck when it came to CONVERTING FIELD VALUES OF AN EXISTING MODEL INTO THE FIELD NAMES OF A NEW ONE (MODEL).
As may be seen from the image I do attach, I have MODEL A with ‘fieldName_3’. I’d appreciate a help to convert the values of this field into the field names of the MODEL B.
Descriptive Image

I want to turn the values P1, P2 and P3 (red colored) in Model_A into fields P1, P2 and P3 (also red colored) in Model_B.
TRIED CODE BELOW:
from django.db import models
CHOICES = (('option1','option1'),('option2','option2'))
class Model_A(models.Model):
fieldName_1 = models.CharField(max_length=50)
fieldName_2 = models.CharField(max_length=20)
fieldName_3 = models.CharField(max_length=3)
class Model_B(models.Model):
def values_from_fildName3():
values = Model_A.fieldName_3
for value in values:
value = models.CharField(max_length=4, choices=CHOICES)
yield value
With the code above I get the error "TypeError: ‘DeferredAttribute’ object is not iterable
My advancing thanks!