Files
elpatron 21e4d86fef Initial commit: Open-Source Projektplattform für Schleswig-Holstein
- Flask-App mit SQLite, Projekt-Einreichung und Bewerbungen
- Suche und Filter nach Kategorie
- Modernes UI mit Bootstrap 5 und Custom CSS
- 6 Demo-Projekte via seed_demo_data.py
- Docker und docker-compose Support

Made-with: Cursor
2026-03-05 19:57:42 +01:00

35 lines
1.4 KiB
Python

from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import ForeignKey
from sqlalchemy.orm import Mapped, mapped_column, relationship
db = SQLAlchemy()
class Projekt(db.Model):
__tablename__ = "projekt"
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
titel: Mapped[str] = mapped_column(nullable=False)
beschreibung: Mapped[str] = mapped_column(nullable=False)
kategorie: Mapped[str] = mapped_column(nullable=False)
behoerde: Mapped[str] = mapped_column(nullable=False)
kontakt_email: Mapped[str] = mapped_column(nullable=False)
status: Mapped[str] = mapped_column(default="offen", nullable=False)
erstellt_am: Mapped[datetime] = mapped_column(default=datetime.utcnow)
bewerbungen = relationship("Bewerbung", back_populates="projekt", cascade="all, delete-orphan")
class Bewerbung(db.Model):
__tablename__ = "bewerbung"
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
projekt_id: Mapped[int] = mapped_column(ForeignKey("projekt.id"), nullable=False)
name: Mapped[str] = mapped_column(nullable=False)
email: Mapped[str] = mapped_column(nullable=False)
nachricht: Mapped[str] = mapped_column(nullable=True)
erstellt_am: Mapped[datetime] = mapped_column(default=datetime.utcnow)
projekt = relationship("Projekt", back_populates="bewerbungen")