fix: configure CI database connection properly
- Add dotenv loading to Django settings - Update CI workflow to use correct environment variables - Set POSTGRES_* variables instead of DATABASE_URL - Add environment variables to all Django management commands - Fixes CI test failures due to database connection issues
This commit is contained in:
31
remove_legacy_views.py
Normal file
31
remove_legacy_views.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to remove legacy Verpachtung views from views.py
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
def remove_legacy_verpachtung_views():
|
||||
with open('app/stiftung/views.py', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Remove verpachtung_export function
|
||||
export_pattern = r'@login_required\s+def verpachtung_export\([^)]+\):[^@]*?pass\s*\n\n'
|
||||
content = re.sub(export_pattern, '', content, flags=re.DOTALL)
|
||||
|
||||
# More aggressive pattern for verpachtung_export
|
||||
export_pattern2 = r'@login_required\s+def verpachtung_export.*?(?=@login_required|def \w+.*?\(.*?\):|\Z)'
|
||||
content = re.sub(export_pattern2, '', content, flags=re.DOTALL)
|
||||
|
||||
# Remove comment and all verpachtung views until next comment
|
||||
verpachtung_section_pattern = r'# Verpachtung Views.*?(?=# [A-Z][^#\n]*Views|\Z)'
|
||||
content = re.sub(verpachtung_section_pattern, '', content, flags=re.DOTALL)
|
||||
|
||||
with open('app/stiftung/views.py', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print("Legacy Verpachtung views removed from views.py")
|
||||
|
||||
if __name__ == "__main__":
|
||||
remove_legacy_verpachtung_views()
|
||||
Reference in New Issue
Block a user