Protect views from viewing if the user has no right to view an object
This commit is contained in:
parent
e461d70b14
commit
730d37c620
9 changed files with 116 additions and 35 deletions
|
|
@ -129,13 +129,14 @@ class Transaction(PolymorphicModel):
|
|||
models.Index(fields=['destination']),
|
||||
]
|
||||
|
||||
def post_save(self, *args, **kwargs):
|
||||
def save(self, *args, **kwargs):
|
||||
"""
|
||||
When saving, also transfer money between two notes
|
||||
"""
|
||||
|
||||
if self.source.pk == self.destination.pk:
|
||||
# When source == destination, no money is transfered
|
||||
super().save(*args, **kwargs)
|
||||
return
|
||||
|
||||
created = self.pk is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue