Add more data to model and login

This commit is contained in:
Nyymix 2025-08-09 22:53:35 +03:00
parent 783e5e92cb
commit 522322b1e1
8 changed files with 147 additions and 6 deletions

View file

@ -3,10 +3,37 @@ from django.db.models import F, Q
class FuelPurchase(models.Model):
GAS_STATION_CHOICES = [
(0, '-'),
(1, 'Neste'),
(2, 'Teboil'),
(3, 'ABC'),
(4, 'Shell'),
(5, 'St1'),
(6, 'SEO'),
(7, 'ysi5'),
]
OCTANE_CHOICES = [
(95, '95'),
(98, '98'),
]
CAR_CHOICES = [
(0, '_'),
(1, 'Renault'),
(2, 'Nissan'),
(3, 'Smart'),
]
purchase_date = models.DateField(null=False, blank=False, verbose_name="Purchase Date")
total_cost = models.DecimalField(null=False, blank=False, max_digits=10, decimal_places=2, verbose_name="Total Cost (€)")
price_per_litre = models.DecimalField(null=False, blank=False, max_digits=6, decimal_places=3, verbose_name="Price per Litre (€)")
amount_litres = models.DecimalField(null=False, blank=False, max_digits=7, decimal_places=2, verbose_name="Amount (litres)")
octane = models.IntegerField(choices=OCTANE_CHOICES, default=95, verbose_name="Octane")
gas_station = models.IntegerField(choices=GAS_STATION_CHOICES, default=1, verbose_name="Gas Station")
car = models.IntegerField(choices=CAR_CHOICES, default=3, verbose_name="Car")
class Meta:
constraints = [
@ -16,6 +43,9 @@ class FuelPurchase(models.Model):
'total_cost',
'price_per_litre',
'amount_litres',
'octane',
'gas_station',
'car',
],
name='unique_fuel_purchase'
),