create lead table
This commit is contained in:
27
backend/routes/migrations/0004_leads.py
Normal file
27
backend/routes/migrations/0004_leads.py
Normal 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'],
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -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}"
|
||||
Reference in New Issue
Block a user