add status functionality
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.2.1 on 2025-05-26 07:11
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('routes', '0006_alter_city_id_alter_country_id_alter_leads_id_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='route',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='route',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('actual', 'Актуально'), ('canceled', 'Отменено'), ('completed', 'Завершено')], default='actual', max_length=20),
|
||||
),
|
||||
]
|
||||
@@ -105,6 +105,17 @@ class Route(models.Model):
|
||||
blank=True, null=True
|
||||
)
|
||||
|
||||
status = models.CharField(
|
||||
max_length=20,
|
||||
choices=[
|
||||
("actual", "Актуально"),
|
||||
("canceled", "Отменено"),
|
||||
("completed", "Завершено"),
|
||||
],
|
||||
default="actual",
|
||||
)
|
||||
created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
from_city_name = self.from_city.name if self.from_city else 'Не указан'
|
||||
to_city_name = self.to_city.name if self.to_city else 'Не указан'
|
||||
|
||||
Reference in New Issue
Block a user