mirror of https://gitlab.crans.org/bde/nk20
add docstring for entry
This commit is contained in:
parent
61b32f9aec
commit
7e0aac0125
|
@ -104,6 +104,12 @@ class Activity(models.Model):
|
|||
|
||||
|
||||
class Entry(models.Model):
|
||||
"""
|
||||
Register the entry of someone:
|
||||
- a member with a :model:`note.NoteUser`
|
||||
- or a :model:`activity.Guest`
|
||||
In the case of a Guest Entry, the inviter note is also save.
|
||||
"""
|
||||
activity = models.ForeignKey(
|
||||
Activity,
|
||||
on_delete=models.PROTECT,
|
||||
|
@ -131,8 +137,7 @@ class Entry(models.Model):
|
|||
class Meta:
|
||||
unique_together = (('activity', 'note', 'guest', ), )
|
||||
|
||||
def save(self, force_insert=False, force_update=False, using=None,
|
||||
update_fields=None):
|
||||
def save(self, *args,**kwargs):
|
||||
|
||||
qs = Entry.objects.filter(~Q(pk=self.pk), activity=self.activity, note=self.note, guest=self.guest)
|
||||
if qs.exists():
|
||||
|
@ -146,7 +151,7 @@ class Entry(models.Model):
|
|||
if self.note.balance < 0:
|
||||
raise ValidationError(_("The balance is negative."))
|
||||
|
||||
ret = super().save(force_insert, force_update, using, update_fields)
|
||||
ret = super().save(*args,**kwargs)
|
||||
|
||||
if insert and self.guest:
|
||||
GuestTransaction.objects.create(
|
||||
|
|
Loading…
Reference in New Issue