Hi everyone, i have two classes in my model.py, this system is for registering the payments of an account, for instance, a client is lent 1000 dollars and that account has an ID, each loan has an ID and what i want is when the client makes the payment of his fees i can register each ammount and that every payment is linked with the ID of the account, 1000 dollars could be 10 payments of 100 dollars and that 10 records are linked to that account and the same for all loans, every loan with its records of payment. I hope that you've could understand and help me.
## THIS IS THE MODEL OF LOANS DATA WHERE THE DATA OF LOAN IS STORED. class LoansData(models.Model): """ Profile model. Proxy model that extend the base data with other informarion. """ customer = models.ForeignKey(CustomerData, on_delete=models.CASCADE) ammount = models.PositiveIntegerField(default=0) interest = models.DecimalField(max_digits=3, decimal_places=2) total = models.PositiveIntegerField(editable=False) uid = models.CharField('UUID', max_length=5, help_text='5 characters', blank=True) created = models.DateField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) def save(self, *args, **kwargs): self.total = self.ammount + (self.ammount*self.interest) super(LoansData, self).save(*args, **kwargs) class Meta: verbose_name = 'Loan Data' verbose_name_plural = 'Loans Data' def __str__(self): """ Return username """ return str(self.pk) #THIS IS WHAT I CREATED FOR ADDING THE RECORDS OF EVERY PAYMENT THE CLIENT MAKES TO ITS RESPECTIVE ACCOUNT OF LOAN. BUT IF IT'S NECESSARY CHANGE THIS IT DOESN'T MATTER. class LoanInstance(models.Model): """ This represents the status up to date of loan """ id = models.UUIDField(primary_key=True, default=uuid.uuid4, help_text="Uniquie ID for every single payment." ) loan = models.ForeignKey('LoansData', on_delete=models.CASCADE, null=True) date = models.DateField(auto_now_add=True) ammount = models.PositiveIntegerField(default=0) def __str__(self): """ Return id """ return '%s' % (self.id) ###################################333 I REALLY HOPE THAT YOU CAN HELP ME PLEASE. I'M STUCK WITH THIS. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4f32f051-3770-493b-b9f5-e42843e88381%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.