2021-10-14 14:12:33 +02:00
|
|
|
"""
|
|
|
|
Author: Michel Peltriaux
|
|
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
|
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
|
|
Created on: 14.10.21
|
|
|
|
|
|
|
|
"""
|
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class CompensationActionManager(models.Manager):
|
|
|
|
""" Holds default db fetch setting for this model type
|
|
|
|
|
|
|
|
"""
|
|
|
|
def get_queryset(self):
|
|
|
|
return super().get_queryset().select_related(
|
|
|
|
"action_type",
|
|
|
|
"action_type__parent"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CompensationStateManager(models.Manager):
|
|
|
|
""" Holds default db fetch setting for this model type
|
|
|
|
|
|
|
|
"""
|
|
|
|
def get_queryset(self):
|
|
|
|
return super().get_queryset().select_related(
|
|
|
|
"biotope_type",
|
|
|
|
"biotope_type__parent"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CompensationManager(models.Manager):
|
|
|
|
""" Holds default db fetch setting for this model type
|
|
|
|
|
|
|
|
"""
|
|
|
|
def get_queryset(self):
|
2022-01-24 14:41:56 +01:00
|
|
|
return super().get_queryset().select_related(
|
2021-10-14 14:12:33 +02:00
|
|
|
"modified",
|
|
|
|
"intervention",
|
|
|
|
"intervention__recorded",
|
|
|
|
"intervention__recorded__user",
|
|
|
|
"intervention__modified",
|
|
|
|
"intervention__checked",
|
|
|
|
"intervention__checked__user",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class EcoAccountManager(models.Manager):
|
|
|
|
""" Holds default db fetch setting for this model type
|
|
|
|
|
|
|
|
"""
|
|
|
|
def get_queryset(self):
|
|
|
|
return super().get_queryset().select_related(
|
|
|
|
"recorded",
|
|
|
|
"recorded__user",
|
|
|
|
"modified",
|
|
|
|
"modified__user",
|
|
|
|
).prefetch_related(
|
|
|
|
"users",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class EcoAccountDeductionManager(models.Manager):
|
|
|
|
""" Holds default db fetch setting for this model type
|
|
|
|
|
|
|
|
"""
|
|
|
|
def get_queryset(self):
|
|
|
|
return super().get_queryset().select_related(
|
|
|
|
"intervention",
|
|
|
|
"intervention__recorded",
|
|
|
|
"created",
|
|
|
|
)
|