Die Dateien wurden wie folgt geändert und hinzugefügt:
1. backend/logs - 'admin', 'admin_api', 'app', 'calendar', 'data_management', 'drucker_steuerung', 'energy_monitoring', 'guest', 'hardware_integration', 'job_queue_system', 'jobs', 'models', 'monitoring_analytics', 'permissions', 'scheduler', 'security_suite', 'startup', '
This commit is contained in:
@ -828,6 +828,43 @@ def inject_current_route():
|
||||
current_route = getattr(request, 'endpoint', None) or ''
|
||||
return {'current_route': current_route}
|
||||
|
||||
@app.context_processor
|
||||
def inject_moment():
|
||||
"""
|
||||
Injiziert eine moment-ähnliche Funktion für Template-Kompatibilität.
|
||||
|
||||
Behebt UndefinedError: 'moment' is not defined in Templates.
|
||||
Ersetzt moment.js durch native Python datetime-Funktionalität.
|
||||
"""
|
||||
def moment():
|
||||
"""Mock moment() Funktion die ein datetime-ähnliches Objekt zurückgibt"""
|
||||
class MomentLike:
|
||||
def __init__(self):
|
||||
self.dt = datetime.now()
|
||||
|
||||
def format(self, format_str):
|
||||
"""Konvertiert moment.js Format-Strings zu Python strftime"""
|
||||
# Moment.js -> Python strftime Mapping
|
||||
format_mapping = {
|
||||
'DD.MM.YYYY': '%d.%m.%Y',
|
||||
'DD/MM/YYYY': '%d/%m/%Y',
|
||||
'YYYY-MM-DD': '%Y-%m-%d',
|
||||
'HH:mm': '%H:%M',
|
||||
'HH:mm:ss': '%H:%M:%S',
|
||||
'DD.MM.YYYY HH:mm': '%d.%m.%Y %H:%M'
|
||||
}
|
||||
|
||||
# Direkte Ersetzung wenn bekanntes Format
|
||||
if format_str in format_mapping:
|
||||
return self.dt.strftime(format_mapping[format_str])
|
||||
|
||||
# Fallback: Standard deutsche Formatierung
|
||||
return self.dt.strftime('%d.%m.%Y')
|
||||
|
||||
return MomentLike()
|
||||
|
||||
return {'moment': moment}
|
||||
|
||||
@app.template_filter('format_datetime')
|
||||
def format_datetime_filter(value, format='%d.%m.%Y %H:%M'):
|
||||
"""Template-Filter für Datums-Formatierung"""
|
||||
|
Reference in New Issue
Block a user