create lead table

This commit is contained in:
2025-05-24 14:14:44 +03:00
parent 4d53b7c2c4
commit e4fcf0716d
5 changed files with 60 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
# Generated by Django 5.2.1 on 2025-05-24 11:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('routes', '0003_alter_route_owner_type'),
]
operations = [
migrations.CreateModel(
name='Leads',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('moving_date', models.DateField()),
('comment', models.CharField(blank=True, max_length=500, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'verbose_name': 'Заявка',
'verbose_name_plural': 'Заявки',
'ordering': ['-created_at'],
},
),
]

View File

@@ -112,3 +112,19 @@ class Route(models.Model):
verbose_name = (u'Маршрут')
verbose_name_plural = (u'Маршруты')
ordering = ('id',)
class Leads(models.Model):
route = models.ForeignKey(Route, verbose_name="Маршрут", on_delete=models.CASCADE),
moving_user = models.ForeignKey(User, verbose_name="Перевозчик", on_delete=models.CASCADE),
moving_price = models.DecimalField(max_digits=10, decimal_places=2),
moving_date = models.DateField()
comment = models.CharField(max_length=500, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name = 'Заявка'
verbose_name_plural = 'Заявки'
ordering = ['-created_at']
def __str__(self):
return f"Заявка по маршруту ${self.route}"