【发布时间】:2022-01-11 03:47:23
【问题描述】:
我正在创建一个应用程序,人们可以在其中登录并创建委员会并邀请其他用户加入他们的委员会,然后加入该委员会的人将每月支付委员会费用,直到结束日期。并且其中一位用户将在每个月底获得委员会,我遇到了一个问题,我不知道如何存储按月付费的用户的数据。我已经创建了所有这些 django 模型。但是现在缺少的部分是存储每个月的数据,以便我可以将状态显示为待处理或已完成。
class Committee(models.Model):
committee_creator = models.ForeignKey(Profile, on_delete=models.CASCADE)
committee_name = models.CharField(max_length=100)
committee_members_limit = models.IntegerField()
committee_amount_per_month = models.IntegerField(default=0)
committee_month_period = models.IntegerField(default=0)
committee_amount_limit = models.IntegerField(null=True)
committee_starting_date = models.DateTimeField(auto_now_add=False)
committee_ending_date = models.DateTimeField(auto_now_add=False)
class Participants(models.Model):
participants_name = models.ForeignKey(Profile, on_delete=models.CASCADE)
participants_committee_name = models.ForeignKey(Committee, on_delete=models.CASCADE)
participants_paid_status = models.BooleanField(default=False)
participants_amount_paid = models.IntegerField()
participants_payment_slip = models.ImageField(upload_to='images/', null=True, blank=True)
【问题讨论】:
标签: python sql django database