loko/streetup/inspections/apps.py

22 lines
743 B
Python

from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class InspectionsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'inspections'
verbose_name = _("Inspections & Contrôles")
def ready(self):
try:
from common.private_files.registry import register
def guard_inspection_document(obj, user):
if not user.is_authenticated:
return False
return True
register('inspections', 'InspectionDocument', 'file', guard_inspection_document)
register('assets', 'InspectionDocument', 'file', guard_inspection_document)
except Exception:
pass