mirror of https://github.com/snachodog/mybuddy.git
Add tags to Pumping model
This commit is contained in:
parent
d1344a06c2
commit
945e30adb9
|
@ -138,10 +138,10 @@ class TaggableModelForm(forms.ModelForm):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PumpingForm(CoreModelForm):
|
class PumpingForm(CoreModelForm, TaggableModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Pumping
|
model = models.Pumping
|
||||||
fields = ["child", "amount", "time", "notes"]
|
fields = ["child", "amount", "time", "notes", "tags"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"child": ChildRadioSelect,
|
"child": ChildRadioSelect,
|
||||||
"time": forms.DateTimeInput(
|
"time": forms.DateTimeInput(
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Generated by Django 4.1.3 on 2023-01-28 13:59
|
||||||
|
|
||||||
|
import core.models
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("core", "0024_alter_tag_slug"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="pumping",
|
||||||
|
name="tags",
|
||||||
|
field=core.models.TaggableManager(
|
||||||
|
blank=True,
|
||||||
|
help_text="A comma-separated list of tags.",
|
||||||
|
through="core.Tagged",
|
||||||
|
to="core.Tag",
|
||||||
|
verbose_name="Tags",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -428,6 +428,7 @@ class Pumping(models.Model):
|
||||||
amount = models.FloatField(blank=False, null=False, verbose_name=_("Amount"))
|
amount = models.FloatField(blank=False, null=False, verbose_name=_("Amount"))
|
||||||
time = models.DateTimeField(blank=False, null=False, verbose_name=_("Time"))
|
time = models.DateTimeField(blank=False, null=False, verbose_name=_("Time"))
|
||||||
notes = models.TextField(blank=True, null=True, verbose_name=_("Notes"))
|
notes = models.TextField(blank=True, null=True, verbose_name=_("Notes"))
|
||||||
|
tags = TaggableManager(blank=True, through=Tagged)
|
||||||
|
|
||||||
objects = models.Manager()
|
objects = models.Manager()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue