Revision 37c42c95 db/models.py

b/db/models.py
27 27
    monthly_rate = models.IntegerField()
28 28
    user = models.ForeignKey(User)
29 29
    limits = models.ManyToManyField(Limit, through='UserLimit')
30
    violations = models.IntegerField()
31
    max_violations = models.IntegerField(default=3)
30 32
    
31 33
    class Meta:
32 34
        verbose_name = u'Synnefo User'
......
44 46
        total_cost = float(cost)*total_hours
45 47
        
46 48
        self.credit = self.credit - round(total_cost)
49
        
50
        if self.credit < 0:
51
            self.violations = self.violations + 1
52
        else:
53
            self.violations = 0
47 54
                
48 55
        return self.credit
49 56
    

Also available in: Unified diff