I'm new to django and i've got this two django models. Now i'm trying to query the stripe in the second model(GenerateKeys) which has the Stripe as the foreignkey and the way i'm doing it is like this "
stripe.stripe_customer.all()
" so i can get the individual data from each user in the Stripe model and use it in the Generateakeys model. But i keep getting this error below
AttributeError: 'QuerySet' object has no attribute 'stripe_customer'
class Stripe(models.Model):
user = models.OneToOneField(to=User, on_delete=models.CASCADE)
CustomerId = models.CharField(max_length=255)
class GenerateKeys(models.Model):
stripe = models.ForeignKey(Stripe,on_delete=models.CASCADE,related_name='stripe_customer')
key_sha = models.CharField(max_length=255)
Thanks.