Prototype implementation

This commit is contained in:
2026-05-08 14:26:48 +02:00
parent 315143a6fc
commit 14b0bc6d01
160 changed files with 5731 additions and 42 deletions

View File

@@ -0,0 +1,10 @@
from django.contrib import admin
from .models import Preispunkt
@admin.register(Preispunkt)
class PreispunktAdmin(admin.ModelAdmin):
list_display = ['konkrete_leistung', 'leistungstyp', 'einzelpreis', 'vergleichsgewicht', 'waehrung']
list_filter = ['wiederkehrend', 'subunternehmeranteil']
search_fields = ['konkrete_leistung', 'leistungstyp']

View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class PreiseConfig(AppConfig):
name = 'vergabe_teilnahme.apps.preise'

View File

@@ -0,0 +1,48 @@
# Generated by Django 6.0.5 on 2026-05-08 10:33
import django.db.models.deletion
from decimal import Decimal
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('ausschreibungen', '0001_initial'),
('lose', '0001_initial'),
('partner', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Preispunkt',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('leistungstyp', models.CharField(max_length=200)),
('konkrete_leistung', models.CharField(max_length=400)),
('mengeneinheit', models.CharField(default='Stück', max_length=50)),
('waehrung', models.CharField(default='EUR', max_length=10)),
('menge', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True)),
('einzelpreis', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
('gesamtpreis', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
('preisstand', models.DateField(blank=True, null=True)),
('wiederkehrend', models.BooleanField(default=False)),
('laufzeitbezug', models.CharField(blank=True, max_length=100)),
('subunternehmeranteil', models.BooleanField(default=False)),
('vergleichsgewicht', models.DecimalField(decimal_places=1, default=Decimal('1.0'), max_digits=3)),
('gewichtungsbegruendung', models.TextField(blank=True)),
('kommentar', models.TextField(blank=True)),
('ausschreibung_gewonnen', models.BooleanField(null=True)),
('ausschreibung', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='preispunkte', to='ausschreibungen.ausschreibung')),
('los', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='preispunkte', to='lose.los')),
('subunternehmer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='preispunkte', to='partner.subunternehmer')),
],
options={
'verbose_name': 'Preispunkt',
'verbose_name_plural': 'Preispunkte',
'ordering': ['leistungstyp', 'konkrete_leistung'],
},
),
]

View File

@@ -0,0 +1,49 @@
from decimal import Decimal
from django.core.exceptions import ValidationError
from django.db import models
from vergabe_teilnahme.apps.core.models import FlexibleModel
class Preispunkt(FlexibleModel):
ausschreibung = models.ForeignKey(
'ausschreibungen.Ausschreibung', on_delete=models.CASCADE, related_name='preispunkte'
)
los = models.ForeignKey(
'lose.Los', on_delete=models.SET_NULL, null=True, blank=True, related_name='preispunkte'
)
leistungstyp = models.CharField(max_length=200)
konkrete_leistung = models.CharField(max_length=400)
mengeneinheit = models.CharField(max_length=50, default='Stück')
waehrung = models.CharField(max_length=10, default='EUR')
menge = models.DecimalField(max_digits=14, decimal_places=4, null=True, blank=True)
einzelpreis = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=True)
gesamtpreis = models.DecimalField(max_digits=14, decimal_places=2, null=True, blank=True)
preisstand = models.DateField(null=True, blank=True)
wiederkehrend = models.BooleanField(default=False)
laufzeitbezug = models.CharField(max_length=100, blank=True)
subunternehmeranteil = models.BooleanField(default=False)
subunternehmer = models.ForeignKey(
'partner.Subunternehmer', on_delete=models.SET_NULL,
null=True, blank=True, related_name='preispunkte'
)
vergleichsgewicht = models.DecimalField(max_digits=3, decimal_places=1, default=Decimal('1.0'))
gewichtungsbegruendung = models.TextField(blank=True)
kommentar = models.TextField(blank=True)
ausschreibung_gewonnen = models.BooleanField(null=True)
class Meta:
ordering = ['leistungstyp', 'konkrete_leistung']
verbose_name = 'Preispunkt'
verbose_name_plural = 'Preispunkte'
def __str__(self):
return f'{self.leistungstyp}{self.konkrete_leistung}'
def clean(self):
if self.vergleichsgewicht is not None:
if self.vergleichsgewicht < Decimal('0.0') or self.vergleichsgewicht > Decimal('2.0'):
raise ValidationError(
'Vergleichsgewicht muss zwischen 0,0 und 2,0 liegen.'
)

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,2 @@
from django.urls import path
urlpatterns = []

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.