Compensation users refactoring
* moves accessibility of compensations completely into related intervention.users set * this way the visibility for a compensation can not differ from the one of the 'parent' intervention
This commit is contained in:
parent
4647be958b
commit
5858a5fdf9
@ -18,6 +18,24 @@ class CompensationTableFilter(InterventionTableFilter):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def _filter_show_all(self, queryset, name, value) -> QuerySet:
|
||||||
|
""" Filters queryset depending on value of 'show_all' setting
|
||||||
|
|
||||||
|
Args:
|
||||||
|
queryset ():
|
||||||
|
name ():
|
||||||
|
value ():
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
if not value:
|
||||||
|
return queryset.filter(
|
||||||
|
intervention__users__in=[self.user], # requesting user has access
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return queryset
|
||||||
|
|
||||||
def _filter_show_recorded(self, queryset, name, value) -> QuerySet:
|
def _filter_show_recorded(self, queryset, name, value) -> QuerySet:
|
||||||
""" Filters queryset depending on value of 'show_recorded' setting
|
""" Filters queryset depending on value of 'show_recorded' setting
|
||||||
|
|
||||||
|
@ -100,9 +100,6 @@ class Compensation(BaseObject):
|
|||||||
related_name='compensations'
|
related_name='compensations'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Users having access on this object
|
|
||||||
users = models.ManyToManyField(User)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _generate_new_identifier() -> str:
|
def _generate_new_identifier() -> str:
|
||||||
""" Generates a new identifier for the intervention object
|
""" Generates a new identifier for the intervention object
|
||||||
@ -153,3 +150,6 @@ class EcoAccount(Compensation):
|
|||||||
with some kind of currency. From this account one is able to 'withdraw' currency for current projects.
|
with some kind of currency. From this account one is able to 'withdraw' currency for current projects.
|
||||||
"""
|
"""
|
||||||
handler = models.CharField(max_length=500, null=True, blank=True, help_text="Who is responsible for handling the actions")
|
handler = models.CharField(max_length=500, null=True, blank=True, help_text="Who is responsible for handling the actions")
|
||||||
|
|
||||||
|
# Users having access on this object
|
||||||
|
users = models.ManyToManyField(User)
|
||||||
|
Loading…
Reference in New Issue
Block a user