From 4ceb6095d3fe9c4ba94f6df6e27e048042ed4d4e Mon Sep 17 00:00:00 2001 From: bugbountyguy Date: Fri, 4 Mar 2022 09:39:13 -0600 Subject: [PATCH] Rename breastpump to pumping --- api/filters.py | 4 +-- api/serializers.py | 4 +-- api/tests.py | 8 ++--- api/urls.py | 2 +- api/views.py | 8 ++--- babybuddy/fixtures/tests.json | 2 +- babybuddy/management/commands/fake.py | 14 ++++---- babybuddy/static_src/fontello/config.json | 2 +- .../fontello/css/babybuddy-codes.css | 2 +- .../fontello/css/babybuddy-embedded.css | 2 +- .../fontello/css/babybuddy-ie7-codes.css | 2 +- .../static_src/fontello/css/babybuddy-ie7.css | 2 +- .../static_src/fontello/css/babybuddy.css | 2 +- babybuddy/static_src/fontello/demo.html | 2 +- .../static_src/fontello/font/babybuddy.svg | 2 +- .../templates/babybuddy/nav-dropdown.html | 26 +++++++------- core/admin.py | 10 +++--- core/forms.py | 4 +-- .../{0019_breastpump.py => 0019_pumping.py} | 10 +++--- core/models.py | 12 +++---- ...elete.html => pumping_confirm_delete.html} | 6 ++-- ...breastpump_form.html => pumping_form.html} | 8 ++--- ...breastpump_list.html => pumping_list.html} | 34 +++++++++--------- core/tests/tests_forms.py | 18 +++++----- core/tests/tests_import_export.py | 4 +-- core/tests/tests_models.py | 10 +++--- core/tests/tests_views.py | 12 +++---- core/urls.py | 16 ++++----- core/views.py | 36 +++++++++---------- docs/api.md | 2 +- docs/user-guide/getting-started.md | 2 +- reports/graphs/__init__.py | 2 +- ...eastpump_amounts.py => pumping_amounts.py} | 12 +++---- ...pump_amounts.html => pumping_amounts.html} | 4 +-- reports/templates/reports/report_list.html | 2 +- reports/tests/tests_views.py | 2 +- reports/urls.py | 6 ++-- reports/views.py | 12 +++---- .../babybuddy/font/babybuddy.6fefdbe0c0bb.svg | 2 +- static/babybuddy/font/babybuddy.svg | 2 +- 40 files changed, 156 insertions(+), 156 deletions(-) rename core/migrations/{0019_breastpump.py => 0019_pumping.py} (86%) rename core/templates/core/{breastpump_confirm_delete.html => pumping_confirm_delete.html} (64%) rename core/templates/core/{breastpump_form.html => pumping_form.html} (76%) rename core/templates/core/{breastpump_list.html => pumping_list.html} (61%) rename reports/graphs/{breastpump_amounts.py => pumping_amounts.py} (76%) rename reports/templates/reports/{breastpump_amounts.html => pumping_amounts.html} (65%) diff --git a/api/filters.py b/api/filters.py index 21149f09..fc65ffc6 100644 --- a/api/filters.py +++ b/api/filters.py @@ -63,9 +63,9 @@ class StartEndFieldFilter(ChildFieldFilter): ) -class BreastpumpFilter(TimeFieldFilter): +class PumpingFilter(TimeFieldFilter): class Meta(TimeFieldFilter.Meta): - model = models.Breastpump + model = models.Pumping class DiaperChangeFilter(TimeFieldFilter, TagsFieldFilter): diff --git a/api/serializers.py b/api/serializers.py index ba5788a6..8d03fe12 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -102,9 +102,9 @@ class UserSerializer(serializers.ModelSerializer): fields = ("id", "username") -class BreastpumpSerializer(CoreModelSerializer): +class PumpingSerializer(CoreModelSerializer): class Meta: - model = models.Breastpump + model = models.Pumping fields = ("id", "child", "amount", "time", "notes") diff --git a/api/tests.py b/api/tests.py index 08ade7e8..ebf14e80 100644 --- a/api/tests.py +++ b/api/tests.py @@ -129,9 +129,9 @@ class ChildAPITestCase(TestBase.BabyBuddyAPITestCaseBase): self.assertEqual(response.data, entry) -class BreastpumpAPITestCase(TestBase.BabyBuddyAPITestCaseBase): - endpoint = reverse("api:breastpump-list") - model = models.Breastpump +class PumpingAPITestCase(TestBase.BabyBuddyAPITestCaseBase): + endpoint = reverse("api:pumping-list") + model = models.Pumping def test_get(self): response = self.client.get(self.endpoint) @@ -156,7 +156,7 @@ class BreastpumpAPITestCase(TestBase.BabyBuddyAPITestCaseBase): } response = self.client.post(self.endpoint, data, format="json") self.assertEqual(response.status_code, status.HTTP_201_CREATED) - obj = models.Breastpump.objects.get(pk=response.data["id"]) + obj = models.Pumping.objects.get(pk=response.data["id"]) self.assertEqual(str(obj.amount), data["amount"]) self.assertEqual(obj.notes, data["notes"]) diff --git a/api/urls.py b/api/urls.py index 43955654..213994da 100644 --- a/api/urls.py +++ b/api/urls.py @@ -11,7 +11,7 @@ router.register(r"changes", views.DiaperChangeViewSet) router.register(r"feedings", views.FeedingViewSet) router.register(r"notes", views.NoteViewSet) router.register(r"sleep", views.SleepViewSet) -router.register(r"breastpump", views.BreastpumpViewSet) +router.register(r"pumping", views.PumpingViewSet) router.register(r"temperature", views.TemperatureViewSet) router.register(r"timers", views.TimerViewSet) router.register(r"tummy-times", views.TummyTimeViewSet) diff --git a/api/views.py b/api/views.py index df5d010d..f8b7a9e3 100644 --- a/api/views.py +++ b/api/views.py @@ -16,10 +16,10 @@ class ChildViewSet(viewsets.ModelViewSet): filterset_fields = ("first_name", "last_name", "slug", "birth_date") -class BreastpumpViewSet(viewsets.ModelViewSet): - queryset = models.Breastpump.objects.all() - serializer_class = serializers.BreastpumpSerializer - filterset_class = filters.BreastpumpFilter +class PumpingViewSet(viewsets.ModelViewSet): + queryset = models.Pumping.objects.all() + serializer_class = serializers.PumpingSerializer + filterset_class = filters.PumpingFilter class DiaperChangeViewSet(viewsets.ModelViewSet): diff --git a/babybuddy/fixtures/tests.json b/babybuddy/fixtures/tests.json index 6ef9d1ce..e92aa1f0 100644 --- a/babybuddy/fixtures/tests.json +++ b/babybuddy/fixtures/tests.json @@ -22,7 +22,7 @@ } }, { - "model": "core.breastpump", + "model": "core.pumping", "pk": 1, "fields": { diff --git a/babybuddy/management/commands/fake.py b/babybuddy/management/commands/fake.py index 5abeb117..4802eb0b 100644 --- a/babybuddy/management/commands/fake.py +++ b/babybuddy/management/commands/fake.py @@ -75,8 +75,8 @@ class Command(BaseCommand): """ self.time = self.child.birth_date - self.breastpump = round(uniform(95.0, 102.0), 2) - self._add_breastpump_entry() + self.pumping = round(uniform(95.0, 102.0), 2) + self._add_pumping_entry() self.temperature = round(uniform(95.0, 102.0), 2) self._add_temperature_entry() @@ -106,7 +106,7 @@ class Command(BaseCommand): self._add_diaperchange_entry() self._add_feeding_entry() self._add_diaperchange_entry() - self._add_breastpump_entry() + self._add_pumping_entry() if choice([True, False]): self._add_tummytime_entry() if choice([True, False]): @@ -115,7 +115,7 @@ class Command(BaseCommand): if choice([True, False]): self._add_temperature_entry() if choice([True, False]): - self._add_breastpump_entry() + self._add_pumping_entry() if (self.time - last_note_entry_time).days > 1 and choice([True, False]): self._add_note_entry() last_note_entry_time = self.time @@ -133,9 +133,9 @@ class Command(BaseCommand): last_bmi_entry_time = self.time @transaction.atomic - def _add_breastpump_entry(self): + def _add_pumping_entry(self): """ - Add a Breastpump entry. This assumes a weekly interval. + Add a Pumping entry. This assumes a weekly interval. :returns: """ self.amount = round(uniform(95.0, 102.0), 2) @@ -144,7 +144,7 @@ class Command(BaseCommand): if choice([True, False, False, False]): notes = " ".join(self.faker.sentences(randint(1, 5))) - models.Breastpump.objects.create( + models.Pumping.objects.create( child=self.child, amount=self.amount, time=self.time, notes=notes ).save() diff --git a/babybuddy/static_src/fontello/config.json b/babybuddy/static_src/fontello/config.json index ec840049..e415a3d8 100644 --- a/babybuddy/static_src/fontello/config.json +++ b/babybuddy/static_src/fontello/config.json @@ -248,7 +248,7 @@ }, { "uid": "4efb719e797c54b3c58e5ae061d29d53", - "css": "breastpump", + "css": "pumping", "code": 62631, "src": "entypo" } diff --git a/babybuddy/static_src/fontello/css/babybuddy-codes.css b/babybuddy/static_src/fontello/css/babybuddy-codes.css index aead7a1d..9fe3c1c0 100644 --- a/babybuddy/static_src/fontello/css/babybuddy-codes.css +++ b/babybuddy/static_src/fontello/css/babybuddy-codes.css @@ -39,4 +39,4 @@ .icon-today:before { content: '\f274'; } /* '' */ .icon-bmi:before { content: '\f295'; } /* '' */ .icon-temperature:before { content: '\f2c8'; } /* '' */ -.icon-breastpump:before { content: '\f4a7'; } /* '' */ +.icon-pumping:before { content: '\f4a7'; } /* '' */ diff --git a/babybuddy/static_src/fontello/css/babybuddy-embedded.css b/babybuddy/static_src/fontello/css/babybuddy-embedded.css index 2cd569a1..9a4c0f7f 100644 --- a/babybuddy/static_src/fontello/css/babybuddy-embedded.css +++ b/babybuddy/static_src/fontello/css/babybuddy-embedded.css @@ -97,4 +97,4 @@ .icon-today:before { content: '\f274'; } /* '' */ .icon-bmi:before { content: '\f295'; } /* '' */ .icon-temperature:before { content: '\f2c8'; } /* '' */ -.icon-breastpump:before { content: '\f4a7'; } /* '' */ +.icon-pumping:before { content: '\f4a7'; } /* '' */ diff --git a/babybuddy/static_src/fontello/css/babybuddy-ie7-codes.css b/babybuddy/static_src/fontello/css/babybuddy-ie7-codes.css index 98e8d5a0..895d618a 100644 --- a/babybuddy/static_src/fontello/css/babybuddy-ie7-codes.css +++ b/babybuddy/static_src/fontello/css/babybuddy-ie7-codes.css @@ -39,4 +39,4 @@ .icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-bmi { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-temperature { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } -.icon-breastpump { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } +.icon-pumping { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } diff --git a/babybuddy/static_src/fontello/css/babybuddy-ie7.css b/babybuddy/static_src/fontello/css/babybuddy-ie7.css index 793700a8..0247a309 100644 --- a/babybuddy/static_src/fontello/css/babybuddy-ie7.css +++ b/babybuddy/static_src/fontello/css/babybuddy-ie7.css @@ -50,4 +50,4 @@ .icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-bmi { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-temperature { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } -.icon-breastpump { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } +.icon-pumping { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } diff --git a/babybuddy/static_src/fontello/css/babybuddy.css b/babybuddy/static_src/fontello/css/babybuddy.css index 726dc91e..fed1475b 100644 --- a/babybuddy/static_src/fontello/css/babybuddy.css +++ b/babybuddy/static_src/fontello/css/babybuddy.css @@ -94,4 +94,4 @@ .icon-today:before { content: '\f274'; } /* '' */ .icon-bmi:before { content: '\f295'; } /* '' */ .icon-temperature:before { content: '\f2c8'; } /* '' */ -.icon-breastpump:before { content: '\f4a7'; } /* '' */ +.icon-pumping:before { content: '\f4a7'; } /* '' */ diff --git a/babybuddy/static_src/fontello/demo.html b/babybuddy/static_src/fontello/demo.html index 53f6c0e7..acfdcca5 100644 --- a/babybuddy/static_src/fontello/demo.html +++ b/babybuddy/static_src/fontello/demo.html @@ -352,7 +352,7 @@
- icon-breastpump0xf4a7 + icon-pumping0xf4a7
diff --git a/babybuddy/static_src/fontello/font/babybuddy.svg b/babybuddy/static_src/fontello/font/babybuddy.svg index 5f27f320..d91dbe4a 100644 --- a/babybuddy/static_src/fontello/font/babybuddy.svg +++ b/babybuddy/static_src/fontello/font/babybuddy.svg @@ -86,7 +86,7 @@ - + diff --git a/babybuddy/templates/babybuddy/nav-dropdown.html b/babybuddy/templates/babybuddy/nav-dropdown.html index 5943beed..bc10fc79 100644 --- a/babybuddy/templates/babybuddy/nav-dropdown.html +++ b/babybuddy/templates/babybuddy/nav-dropdown.html @@ -87,10 +87,10 @@ {% trans "Weight" %} {% endif %} - {% if perms.core.add_breastpump %} - - - {% trans "Breastpump" %} + {% if perms.core.add_pumping %} + + + {% trans "Pumping" %} {% endif %} @@ -241,17 +241,17 @@ {% endif %} - {% if perms.core.view_breastpump %} - - - {% trans "Breastpump" %} + {% if perms.core.view_pumping %} + + + {% trans "Pumping" %} {% endif %} - {% if perms.core.add_breastpump %} - - {% trans "Breastpump entry" %} + {% if perms.core.add_pumping %} + + {% trans "Pumping entry" %} {% endif %} diff --git a/core/admin.py b/core/admin.py index 7e6bc963..7f2d8757 100644 --- a/core/admin.py +++ b/core/admin.py @@ -58,13 +58,13 @@ class ChildAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin): resource_class = ChildImportExportResource -class BreastpumpImportExportResource(ImportExportResourceBase): +class PumpingImportExportResource(ImportExportResourceBase): class Meta: - model = models.Breastpump + model = models.Pumping -@admin.register(models.Breastpump) -class BreastpumpAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin): +@admin.register(models.Pumping) +class PumpingAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin): list_display = ( "child", "amount", @@ -76,7 +76,7 @@ class BreastpumpAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin): "child__last_name", "amount", ) - resource_class = BreastpumpImportExportResource + resource_class = PumpingImportExportResource class DiaperChangeImportExportResource(ImportExportResourceBase): diff --git a/core/forms.py b/core/forms.py index d46683f2..dd4ebe46 100644 --- a/core/forms.py +++ b/core/forms.py @@ -124,9 +124,9 @@ class ChildDeleteForm(forms.ModelForm): return instance -class BreastpumpForm(CoreModelForm): +class PumpingForm(CoreModelForm): class Meta: - model = models.Breastpump + model = models.Pumping fields = ["child", "amount", "time", "notes"] widgets = { "time": forms.DateTimeInput( diff --git a/core/migrations/0019_breastpump.py b/core/migrations/0019_pumping.py similarity index 86% rename from core/migrations/0019_breastpump.py rename to core/migrations/0019_pumping.py index 74ac5132..b0278a6e 100644 --- a/core/migrations/0019_breastpump.py +++ b/core/migrations/0019_pumping.py @@ -12,7 +12,7 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name="Breastpump", + name="Pumping", fields=[ ( "id", @@ -29,21 +29,21 @@ class Migration(migrations.Migration): "child", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, - related_name="breastpump", + related_name="pumping", to="core.Child", verbose_name="Child", ), ), ], options={ - "verbose_name": "Breastpump", - "verbose_name_plural": "Breastpump", + "verbose_name": "Pumping", + "verbose_name_plural": "Pumping", "ordering": ["-time"], "default_permissions": ("view", "add", "change", "delete"), }, ), migrations.AddField( - model_name="breastpump", + model_name="pumping", name="notes", field=models.TextField(blank=True, null=True, verbose_name="Notes"), ), diff --git a/core/models.py b/core/models.py index 55bb650a..036b44d9 100644 --- a/core/models.py +++ b/core/models.py @@ -173,12 +173,12 @@ class TaggableManager(TaggitTaggableManager): return super().formfield(*args, **kwargs) -class Breastpump(models.Model): - model_name = "breastpump" +class Pumping(models.Model): + model_name = "pumping" child = models.ForeignKey( "Child", on_delete=models.CASCADE, - related_name="breastpump", + related_name="pumping", verbose_name=_("Child"), ) amount = models.FloatField(blank=False, null=False, verbose_name=_("Amount")) @@ -190,11 +190,11 @@ class Breastpump(models.Model): class Meta: default_permissions = ("view", "add", "change", "delete") ordering = ["-time"] - verbose_name = _("Breastpump") - verbose_name_plural = _("Breastpump") + verbose_name = _("Pumping") + verbose_name_plural = _("Pumping") def __str__(self): - return str(_("Breastpump")) + return str(_("Pumping")) def clean(self): validate_time(self.time, "time") diff --git a/core/templates/core/breastpump_confirm_delete.html b/core/templates/core/pumping_confirm_delete.html similarity index 64% rename from core/templates/core/breastpump_confirm_delete.html rename to core/templates/core/pumping_confirm_delete.html index 84ab2bfc..2b5aa6d3 100644 --- a/core/templates/core/breastpump_confirm_delete.html +++ b/core/templates/core/pumping_confirm_delete.html @@ -1,10 +1,10 @@ {% extends 'babybuddy/page.html' %} {% load i18n widget_tweaks %} -{% block title %}{% trans "Delete a Breastpump Reading" %}{% endblock %} +{% block title %}{% trans "Delete a Pumping Reading" %}{% endblock %} {% block breadcrumbs %} - + {% endblock %} @@ -15,6 +15,6 @@

Are you sure you want to delete {{ object }}?

{% endblocktrans %} - {% trans "Cancel" %} + {% trans "Cancel" %} {% endblock %} \ No newline at end of file diff --git a/core/templates/core/breastpump_form.html b/core/templates/core/pumping_form.html similarity index 76% rename from core/templates/core/breastpump_form.html rename to core/templates/core/pumping_form.html index 2190b290..c2a4ce66 100644 --- a/core/templates/core/breastpump_form.html +++ b/core/templates/core/pumping_form.html @@ -5,16 +5,16 @@ {% if object %} {{ object }} {% else %} - {% trans "Add a Breastpump Reading" %} + {% trans "Add a Pumping Reading" %} {% endif %} {% endblock %} {% block breadcrumbs %} - + {% if object %} {% else %} - + {% endif %} {% endblock %} @@ -24,7 +24,7 @@

Update {{ object }}

{% endblocktrans %} {% else %} -

{% trans "Add a Breastpump Entry" %}

+

{% trans "Add a Pumping Entry" %}

{% endif %} {% include 'babybuddy/form.html' %} {% endblock %} diff --git a/core/templates/core/breastpump_list.html b/core/templates/core/pumping_list.html similarity index 61% rename from core/templates/core/breastpump_list.html rename to core/templates/core/pumping_list.html index 729386f2..4f6a9c3c 100644 --- a/core/templates/core/breastpump_list.html +++ b/core/templates/core/pumping_list.html @@ -1,18 +1,18 @@ {% extends 'babybuddy/page.html' %} {% load datetime i18n widget_tweaks %} -{% block title %}{% trans "Breastpump" %}{% endblock %} +{% block title %}{% trans "Pumping" %}{% endblock %} {% block breadcrumbs %} - + {% endblock %} {% block content %}

- {% trans "Breastpump" %} - {% if perms.core.add_breastpump %} - - {% trans "Add Breastpump Entry" %} + {% trans "Pumping" %} + {% if perms.core.add_pumping %} + + {% trans "Add Pumping Entry" %} {% endif %}

@@ -30,40 +30,40 @@ - {% for breastpump in object_list %} + {% for pumping in object_list %} {% cycle "odd" "even" as row_class silent %}
- {% if perms.core.change_breastpump %} - + {% if perms.core.change_pumping %} + {% endif %} - {% if perms.core.delete_breastpump %} - + {% if perms.core.delete_pumping %} + {% endif %}
- {{ breastpump.time|datetime_short }} + {{ pumping.time|datetime_short }} {% if not unique_child %} - {{ breastpump.child }} + {{ pumping.child }} {% endif %} - {{ breastpump.amount }} + {{ pumping.amount }} - {% if breastpump.notes %} + {% if pumping.notes %} - {{ breastpump.notes }} + {{ pumping.notes }} {% endif %} {% empty %} - {% trans "No breastpump entries found." %} + {% trans "No pumping entries found." %} {% endfor %} diff --git a/core/tests/tests_forms.py b/core/tests/tests_forms.py index 9cd08423..7c752ac5 100644 --- a/core/tests/tests_forms.py +++ b/core/tests/tests_forms.py @@ -194,11 +194,11 @@ class ChildFormsTestCase(FormsTestCaseBase): self.assertContains(page, "Child entry deleted") -class BreastpumpFormsTestCase(FormsTestCaseBase): +class PumpingFormsTestCase(FormsTestCaseBase): @classmethod def setUpClass(cls): - super(BreastpumpFormsTestCase, cls).setUpClass() - cls.bp = models.Breastpump.objects.create( + super(PumpingFormsTestCase, cls).setUpClass() + cls.bp = models.Pumping.objects.create( child=cls.child, amount=50.0, time=timezone.localtime() - timezone.timedelta(days=1), @@ -211,10 +211,10 @@ class BreastpumpFormsTestCase(FormsTestCaseBase): "time": self.localtime_string(), } - page = self.c.post("/breastpump/add/", params, follow=True) + page = self.c.post("/pumping/add/", params, follow=True) self.assertEqual(page.status_code, 200) self.assertContains( - page, "Breastpump entry for {} added".format(str(self.child)) + page, "Pumping entry for {} added".format(str(self.child)) ) def test_edit(self): @@ -223,18 +223,18 @@ class BreastpumpFormsTestCase(FormsTestCaseBase): "amount": self.bp.amount + 2, "time": self.localtime_string(), } - page = self.c.post("/breastpump/{}/".format(self.bp.id), params, follow=True) + page = self.c.post("/pumping/{}/".format(self.bp.id), params, follow=True) self.assertEqual(page.status_code, 200) self.bp.refresh_from_db() self.assertEqual(self.bp.amount, params["amount"]) self.assertContains( - page, "Breastpump entry for {} updated".format(str(self.bp.child)) + page, "Pumping entry for {} updated".format(str(self.bp.child)) ) def test_delete(self): - page = self.c.post("/breastpump/{}/delete/".format(self.bp.id), follow=True) + page = self.c.post("/pumping/{}/delete/".format(self.bp.id), follow=True) self.assertEqual(page.status_code, 200) - self.assertContains(page, "Breastpump entry deleted") + self.assertContains(page, "Pumping entry deleted") class DiaperChangeFormsTestCase(FormsTestCaseBase): diff --git a/core/tests/tests_import_export.py b/core/tests/tests_import_export.py index cbbe4549..29dff1c8 100644 --- a/core/tests/tests_import_export.py +++ b/core/tests/tests_import_export.py @@ -41,8 +41,8 @@ class ImportTestCase(TestCase): def test_child(self): self.import_data(models.Child, 2) - def test_breastpump(self): - self.import_data(models.Breastpump, 23) + def test_pumping(self): + self.import_data(models.Pumping, 23) def test_diaperchange(self): self.import_data(models.DiaperChange, 75) diff --git a/core/tests/tests_models.py b/core/tests/tests_models.py index 237f3607..479c8180 100644 --- a/core/tests/tests_models.py +++ b/core/tests/tests_models.py @@ -35,21 +35,21 @@ class ChildTestCase(TestCase): self.assertEqual(models.Child.count(), 1) -class BreastpumpTestCase(TestCase): +class PumpingTestCase(TestCase): def setUp(self): call_command("migrate", verbosity=0) self.child = models.Child.objects.create( first_name="First", last_name="Last", birth_date=timezone.localdate() ) - self.temp = models.Breastpump.objects.create( + self.temp = models.Pumping.objects.create( child=self.child, time=timezone.localtime() - timezone.timedelta(days=1), amount=98.6, ) - def test_breastpump_create(self): - self.assertEqual(self.temp, models.Breastpump.objects.first()) - self.assertEqual(str(self.temp), "Breastpump") + def test_pumping_create(self): + self.assertEqual(self.temp, models.Pumping.objects.first()) + self.assertEqual(str(self.temp), "Pumping") self.assertEqual(self.temp.amount, 98.6) diff --git a/core/tests/tests_views.py b/core/tests/tests_views.py index 87243aaa..8d74919b 100644 --- a/core/tests/tests_views.py +++ b/core/tests/tests_views.py @@ -49,16 +49,16 @@ class ViewsTestCase(TestCase): page = self.c.get("/children/{}/delete/".format(entry.slug)) self.assertEqual(page.status_code, 200) - def test_breastpump_views(self): - page = self.c.get("/breastpump/") + def test_pumping_views(self): + page = self.c.get("/pumping/") self.assertEqual(page.status_code, 200) - page = self.c.get("/breastpump/add/") + page = self.c.get("/pumping/add/") self.assertEqual(page.status_code, 200) - entry = models.Breastpump.objects.first() - page = self.c.get("/breastpump/{}/".format(entry.id)) + entry = models.Pumping.objects.first() + page = self.c.get("/pumping/{}/".format(entry.id)) self.assertEqual(page.status_code, 200) - page = self.c.get("/breastpump/{}/delete/".format(entry.id)) + page = self.c.get("/pumping/{}/delete/".format(entry.id)) self.assertEqual(page.status_code, 200) def test_diaperchange_views(self): diff --git a/core/urls.py b/core/urls.py index 453ee34b..c660942c 100644 --- a/core/urls.py +++ b/core/urls.py @@ -6,17 +6,17 @@ from . import views app_name = "core" urlpatterns = [ - path("breastpump/", views.BreastpumpList.as_view(), name="breastpump-list"), - path("breastpump/add/", views.BreastpumpAdd.as_view(), name="breastpump-add"), + path("pumping/", views.PumpingList.as_view(), name="pumping-list"), + path("pumping/add/", views.PumpingAdd.as_view(), name="pumping-add"), path( - "breastpump//", - views.BreastpumpUpdate.as_view(), - name="breastpump-update", + "pumping//", + views.PumpingUpdate.as_view(), + name="pumping-update", ), path( - "breastpump//delete/", - views.BreastpumpDelete.as_view(), - name="breastpump-delete", + "pumping//delete/", + views.PumpingDelete.as_view(), + name="pumping-delete", ), path("children/", views.ChildList.as_view(), name="child-list"), path("children/add/", views.ChildAdd.as_view(), name="child-add"), diff --git a/core/views.py b/core/views.py index 7fc2d614..1ab22ad9 100644 --- a/core/views.py +++ b/core/views.py @@ -121,34 +121,34 @@ class ChildDelete(CoreUpdateView): return success_message % cleaned_data -class BreastpumpList(PermissionRequiredMixin, BabyBuddyFilterView): - model = models.Breastpump - template_name = "core/breastpump_list.html" - permission_required = ("core.view_breastpump",) +class PumpingList(PermissionRequiredMixin, BabyBuddyFilterView): + model = models.Pumping + template_name = "core/pumping_list.html" + permission_required = ("core.view_pumping",) paginate_by = 10 filterset_fields = ("child",) -class BreastpumpAdd(CoreAddView): - model = models.Breastpump - permission_required = ("core.add_breastpump",) - form_class = forms.BreastpumpForm - success_url = reverse_lazy("core:breastpump-list") +class PumpingAdd(CoreAddView): + model = models.Pumping + permission_required = ("core.add_pumping",) + form_class = forms.PumpingForm + success_url = reverse_lazy("core:pumping-list") success_message = _("%(model)s reading added!") -class BreastpumpUpdate(CoreUpdateView): - model = models.Breastpump - permission_required = ("core.change_breastpump",) - form_class = forms.BreastpumpForm - success_url = reverse_lazy("core:breastpump-list") +class PumpingUpdate(CoreUpdateView): + model = models.Pumping + permission_required = ("core.change_pumping",) + form_class = forms.PumpingForm + success_url = reverse_lazy("core:pumping-list") success_message = _("%(model)s reading for %(child)s updated.") -class BreastpumpDelete(CoreDeleteView): - model = models.Breastpump - permission_required = ("core.delete_breastpump",) - success_url = reverse_lazy("core:breastpump-list") +class PumpingDelete(CoreDeleteView): + model = models.Pumping + permission_required = ("core.delete_pumping",) + success_url = reverse_lazy("core:pumping-list") class DiaperChangeList(PermissionRequiredMixin, BabyBuddyFilterView): diff --git a/docs/api.md b/docs/api.md index e97d7c4f..c4e55e5b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -11,7 +11,7 @@ authorization. Currently, the following endpoints are available for `GET`, `OPTIONS`, and `POST` requests: -- `/api/breastpump/` +- `/api/pumping/` - `/api/children/` - `/api/changes/` (Diaper Changes) - `/api/feedings/` diff --git a/docs/user-guide/getting-started.md b/docs/user-guide/getting-started.md index 2ae59699..e71f5e30 100644 --- a/docs/user-guide/getting-started.md +++ b/docs/user-guide/getting-started.md @@ -45,7 +45,7 @@ ability to edit any entry. The Measurements menu provides the option to view and track your baby's measurements of temperature, weight, height, head circumference and BMI. -This section also includes the mother's measurements for breastpump pumped. +This section also includes the mother's measurements for pumping pumped. Selecting any of the measurements will open that specific page with all related measurements listed. diff --git a/reports/graphs/__init__.py b/reports/graphs/__init__.py index 8507e146..1a4bc559 100644 --- a/reports/graphs/__init__.py +++ b/reports/graphs/__init__.py @@ -1,4 +1,4 @@ -from .breastpump_amounts import breastpump_amounts # NOQA +from .pumping_amounts import pumping_amounts # NOQA from .diaperchange_amounts import diaperchange_amounts # NOQA from .diaperchange_lifetimes import diaperchange_lifetimes # NOQA from .diaperchange_types import diaperchange_types # NOQA diff --git a/reports/graphs/breastpump_amounts.py b/reports/graphs/pumping_amounts.py similarity index 76% rename from reports/graphs/breastpump_amounts.py rename to reports/graphs/pumping_amounts.py index 397a3240..0a91c1a5 100644 --- a/reports/graphs/breastpump_amounts.py +++ b/reports/graphs/pumping_amounts.py @@ -8,16 +8,16 @@ import plotly.graph_objs as go from reports import utils -def breastpump_amounts(objects): +def pumping_amounts(objects): """ - Create a graph showing breastpump amounts over time. - :param instances: a QuerySet of Breastpump instances. + Create a graph showing pumping amounts over time. + :param instances: a QuerySet of Pumping instances. :returns: a tuple of the the graph's html and javascript. """ objects = objects.order_by("-time") trace = go.Scatter( - name=_("Breastpump"), + name=_("Pumping"), x=list(objects.values_list("time", flat=True)), y=list(objects.values_list("amount", flat=True)), fill="tozeroy", @@ -25,10 +25,10 @@ def breastpump_amounts(objects): layout_args = utils.default_graph_layout_options() layout_args["barmode"] = "stack" - layout_args["title"] = _("Breastpump") + layout_args["title"] = _("Pumping") layout_args["xaxis"]["title"] = _("Date") layout_args["xaxis"]["rangeselector"] = utils.rangeselector_date() - layout_args["yaxis"]["title"] = _("Breastpump") + layout_args["yaxis"]["title"] = _("Pumping") fig = go.Figure({"data": [trace], "layout": go.Layout(**layout_args)}) output = plotly.plot(fig, output_type="div", include_plotlyjs=False) diff --git a/reports/templates/reports/breastpump_amounts.html b/reports/templates/reports/pumping_amounts.html similarity index 65% rename from reports/templates/reports/breastpump_amounts.html rename to reports/templates/reports/pumping_amounts.html index 867bf1c9..7944e390 100644 --- a/reports/templates/reports/breastpump_amounts.html +++ b/reports/templates/reports/pumping_amounts.html @@ -1,9 +1,9 @@ {% extends 'reports/report_base.html' %} {% load i18n %} -{% block title %}{% trans "Breastpump" %} - {{ object }}{% endblock %} +{% block title %}{% trans "Pumping" %} - {{ object }}{% endblock %} {% block breadcrumbs %} {{ block.super }} - + {% endblock %} diff --git a/reports/templates/reports/report_list.html b/reports/templates/reports/report_list.html index 7a071df2..2d7aaf8c 100644 --- a/reports/templates/reports/report_list.html +++ b/reports/templates/reports/report_list.html @@ -8,7 +8,7 @@

Reports

{% trans "Body Mass Index (BMI)" %} - {% trans "Breastpump Amounts" %} + {% trans "Pumping Amounts" %} {% trans "Diaper Change Amounts" %} {% trans "Diaper Change Types" %} {% trans "Diaper Lifetimes" %} diff --git a/reports/tests/tests_views.py b/reports/tests/tests_views.py index 00981897..2dcf26c8 100644 --- a/reports/tests/tests_views.py +++ b/reports/tests/tests_views.py @@ -35,7 +35,7 @@ class ViewsTestCase(TestCase): page = self.c.get(base_url) self.assertEqual(page.status_code, 200) - page = self.c.get("{}/breastpump/amounts/".format(base_url)) + page = self.c.get("{}/pumping/amounts/".format(base_url)) self.assertEqual(page.status_code, 200) page = self.c.get("{}/changes/amounts/".format(base_url)) diff --git a/reports/urls.py b/reports/urls.py index f91484c4..a7420002 100644 --- a/reports/urls.py +++ b/reports/urls.py @@ -12,9 +12,9 @@ urlpatterns = [ name="report-list", ), path( - "children//reports/breastpump/amounts/", - views.BreastpumpAmounts.as_view(), - name="report-breastpump-amounts-child", + "children//reports/pumping/amounts/", + views.PumpingAmounts.as_view(), + name="report-pumping-amounts-child", ), path( "children//reports/changes/amounts/", diff --git a/reports/views.py b/reports/views.py index da43e985..9f4f0264 100644 --- a/reports/views.py +++ b/reports/views.py @@ -17,21 +17,21 @@ class ChildReportList(PermissionRequiredMixin, DetailView): template_name = "reports/report_list.html" -class BreastpumpAmounts(PermissionRequiredMixin, DetailView): +class PumpingAmounts(PermissionRequiredMixin, DetailView): """ - Graph of breastpump milk amounts collected. + Graph of pumping milk amounts collected. """ model = models.Child permission_required = ("core.view_child",) - template_name = "reports/breastpump_amounts.html" + template_name = "reports/pumping_amounts.html" def get_context_data(self, **kwargs): - context = super(BreastpumpAmounts, self).get_context_data(**kwargs) + context = super(PumpingAmounts, self).get_context_data(**kwargs) child = context["object"] - changes = models.Breastpump.objects.filter(child=child) + changes = models.Pumping.objects.filter(child=child) if changes and changes.count() > 0: - context["html"], context["js"] = graphs.breastpump_amounts(changes) + context["html"], context["js"] = graphs.pumping_amounts(changes) return context diff --git a/static/babybuddy/font/babybuddy.6fefdbe0c0bb.svg b/static/babybuddy/font/babybuddy.6fefdbe0c0bb.svg index 21388572..f2c05faa 100644 --- a/static/babybuddy/font/babybuddy.6fefdbe0c0bb.svg +++ b/static/babybuddy/font/babybuddy.6fefdbe0c0bb.svg @@ -86,7 +86,7 @@ - + diff --git a/static/babybuddy/font/babybuddy.svg b/static/babybuddy/font/babybuddy.svg index 21388572..f2c05faa 100644 --- a/static/babybuddy/font/babybuddy.svg +++ b/static/babybuddy/font/babybuddy.svg @@ -86,7 +86,7 @@ - +