I have two apps name app1 and app2 with the following contents in the respective model.
app1 Model
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
phone = PhoneNumberField(region='NG', max_length=14)
image = models.ImageField(
blank=True, default='images/users/icon.png', upload_to='images/users')
app2 Model
class Testimonials(models.Model):
ACCEPTED = (
('True', 'True'),
('False', 'False'),
)
**name = models.OneToOneField**(
'user.UserProfile', on_delete=models.CASCADE)
job_position = models.CharField(max_length=50)
content = models.TextField(max_length=130)
**testimonial_picture = models.OneToOneField**(
"user.UserProfile", verbose_name=("Testimonial Image"), on_delete=models.CASCADE)
The goal is that I want to automatically populate the testimonial_picture based on the information of the UserProfile, at the admin panel.
I am aware that using related_name in each model field can get me the expected result in the frontend, but how can I get this in the admin section? Thanks in anticipation