diff --git a/babybuddy/templates/babybuddy/nav-dropdown.html b/babybuddy/templates/babybuddy/nav-dropdown.html
index 5bfdfaf3..6b619627 100644
--- a/babybuddy/templates/babybuddy/nav-dropdown.html
+++ b/babybuddy/templates/babybuddy/nav-dropdown.html
@@ -264,7 +264,12 @@
{% trans "Feeding" %}
{% endif %}
-
+ {% if perms.core.add_feeding %}
+
+ {% trans "Bottle Feeding" %}
+
+ {% endif %}
{% if perms.core.view_pumping %}
diff --git a/core/forms.py b/core/forms.py
index 3b1b51a4..9c712865 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -187,6 +187,24 @@ class FeedingForm(CoreModelForm, TaggableModelForm):
}
+class BottleFeedingForm(CoreModelForm, TaggableModelForm):
+ def save(self):
+ instance = super(BottleFeedingForm, self).save(commit=False)
+ instance.method = "bottle"
+ instance.end = instance.start
+ instance.save()
+ return instance
+
+ class Meta:
+ model = models.Feeding
+ fields = ["child", "start", "type", "amount", "notes", "tags"]
+ widgets = {
+ "child": ChildRadioSelect,
+ "start": DateTimeInput(),
+ "notes": forms.Textarea(attrs={"rows": 5}),
+ }
+
+
class NoteForm(CoreModelForm, TaggableModelForm):
class Meta:
model = models.Note
diff --git a/core/templates/core/feeding_form.html b/core/templates/core/feeding_form.html
index 608aaabf..3996f727 100644
--- a/core/templates/core/feeding_form.html
+++ b/core/templates/core/feeding_form.html
@@ -4,6 +4,8 @@
{% block title %}
{% if request.resolver_match.url_name == 'feeding-update' %}
{% trans "Update a Feeding" %}
+ {% elif request.resolver_match.url_name == 'bottle-feeding-add' %}
+ {% trans "Add a Bottle Feeding" %}
{% else %}
{% trans "Add a Feeding" %}
{% endif %}
@@ -23,6 +25,8 @@
{% blocktrans trimmed %}
Update {{ object }}
{% endblocktrans %}
+ {% elif request.resolver_match.url_name == 'bottle-feeding-add' %}
+ {% trans "Add a Bottle Feeding" %}
{% else %}
{% trans "Add a Feeding" %}
{% endif %}
diff --git a/core/urls.py b/core/urls.py
index efbce751..d070ab4b 100644
--- a/core/urls.py
+++ b/core/urls.py
@@ -38,6 +38,11 @@ urlpatterns = [
views.DiaperChangeDelete.as_view(),
name="diaperchange-delete",
),
+ path(
+ "feedings/bottle/add/",
+ views.BottleFeedingAdd.as_view(),
+ name="bottle-feeding-add",
+ ),
path("feedings/", views.FeedingList.as_view(), name="feeding-list"),
path("feedings/add/", views.FeedingAdd.as_view(), name="feeding-add"),
path("feedings//", views.FeedingUpdate.as_view(), name="feeding-update"),
diff --git a/core/views.py b/core/views.py
index 9bac66d0..a120c5fa 100644
--- a/core/views.py
+++ b/core/views.py
@@ -192,6 +192,13 @@ class FeedingAdd(CoreAddView):
success_url = reverse_lazy("core:feeding-list")
+class BottleFeedingAdd(CoreAddView):
+ model = models.Feeding
+ permission_required = ("core.add_feeding",)
+ form_class = forms.BottleFeedingForm
+ success_url = reverse_lazy("core:feeding-list")
+
+
class FeedingUpdate(CoreUpdateView):
model = models.Feeding
permission_required = ("core.change_feeding",)