add fields to CounterSellers

This commit is contained in:
imperosol
2026-03-04 16:54:49 +01:00
parent 1701ab5f33
commit a7c8b318bd
2 changed files with 20 additions and 2 deletions

View File

@@ -69,5 +69,20 @@ class Migration(migrations.Migration):
),
),
],
)
),
migrations.AddField(
model_name="countersellers",
name="created_at",
field=models.DateTimeField(
auto_now_add=True,
default=django.utils.timezone.now,
verbose_name="created at",
),
preserve_default=False,
),
migrations.AddField(
model_name="countersellers",
name="is_regular",
field=models.BooleanField(default=False, verbose_name="regular barman"),
),
]

View File

@@ -748,11 +748,14 @@ class Counter(models.Model):
class CounterSellers(models.Model):
"""Custom through model for the counter-sellers M2M relationship."""
counter = models.ForeignKey(Counter, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
is_regular = models.BooleanField("regular barman", default=False)
created_at = models.DateTimeField(_("created at"), auto_now_add=True)
class Meta:
verbose_name = _("counter seller")
constraints = [
models.UniqueConstraint(
fields=["counter", "user"],