mirror of
https://github.com/ae-utbm/sith.git
synced 2026-03-13 15:15:03 +00:00
add fields to CounterSellers
This commit is contained in:
@@ -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"),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user