Rename breastpump to pumping

This commit is contained in:
bugbountyguy 2022-03-04 09:39:13 -06:00 committed by Christopher Charbonneau Wells
parent ca89797dd0
commit 4ceb6095d3
40 changed files with 156 additions and 156 deletions

View File

@ -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):

View File

@ -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")

View File

@ -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"])

View File

@ -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)

View File

@ -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):

View File

@ -22,7 +22,7 @@
}
},
{
"model": "core.breastpump",
"model": "core.pumping",
"pk": 1,
"fields":
{

View File

@ -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()

View File

@ -248,7 +248,7 @@
},
{
"uid": "4efb719e797c54b3c58e5ae061d29d53",
"css": "breastpump",
"css": "pumping",
"code": 62631,
"src": "entypo"
}

View File

@ -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'; } /* '' */

View File

@ -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'; } /* '' */

View File

@ -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 = ' '); }

View File

@ -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 = ' '); }

View File

@ -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'; } /* '' */

View File

@ -352,7 +352,7 @@
</div>
<div class="row">
<div class="span3" title="Code: 0xf4a7">
<i class="demo-icon icon-breastpump">&#xf4a7;</i> <span class="i-name">icon-breastpump</span><span class="i-code">0xf4a7</span>
<i class="demo-icon icon-pumping">&#xf4a7;</i> <span class="i-name">icon-pumping</span><span class="i-code">0xf4a7</span>
</div>
</div>
<div class="container footer">Generated by <a href="https://fontello.com">fontello.com</a></div>

View File

@ -86,7 +86,7 @@
<glyph glyph-name="temperature" unicode="&#xf2c8;" d="M357 100q0-45-31-76t-76-31-76 31-31 76q0 34 19 61t52 40v363h72v-363q32-12 52-40t19-61z m72 0q0 43-19 80t-53 63v428q0 45-31 76t-76 32-76-32-31-76v-428q-34-25-53-63t-19-80q0-74 53-126t126-53 126 53 53 126z m71 0q0-103-73-177t-177-73-177 73-73 177q0 102 71 175v396q0 75 53 127t126 52 126-52 53-127v-396q71-73 71-175z m71 321v-71h-107v71h107z m0 143v-71h-107v71h107z m0 143v-71h-107v71h107z" horiz-adv-x="571.4" />
<glyph glyph-name="breastpump" unicode="&#xf4a7;" d="M290 822q14-118 60-219t92-159 82-136 36-160q0-114-83-196t-197-82-197 82-83 196q0 82 36 160t82 136 92 159 60 219q2 8 11 8t9-8z m-42-392q2 4-2 14-6 6-14 6t-12-6l-40-58q-32-46-48-70t-34-75-18-101q0-24 17-41t41-17q58 0 58 68 0 94 42 246 2 6 5 17t5 17z" horiz-adv-x="560" />
<glyph glyph-name="pumping" unicode="&#xf4a7;" d="M290 822q14-118 60-219t92-159 82-136 36-160q0-114-83-196t-197-82-197 82-83 196q0 82 36 160t82 136 92 159 60 219q2 8 11 8t9-8z m-42-392q2 4-2 14-6 6-14 6t-12-6l-40-58q-32-46-48-70t-34-75-18-101q0-24 17-41t41-17q58 0 58 68 0 94 42 246 2 6 5 17t5 17z" horiz-adv-x="560" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -87,10 +87,10 @@
{% trans "Weight" %}
</a>
{% endif %}
{% if perms.core.add_breastpump %}
<a class="dropdown-item p-2" href="{% url 'core:breastpump-add' %}">
<i class="icon-breastpump" aria-hidden="true"></i>
{% trans "Breastpump" %}
{% if perms.core.add_pumping %}
<a class="dropdown-item p-2" href="{% url 'core:pumping-add' %}">
<i class="icon-pumping" aria-hidden="true"></i>
{% trans "Pumping" %}
</a>
{% endif %}
</div>
@ -241,17 +241,17 @@
</a>
{% endif %}
{% if perms.core.view_breastpump %}
<a class="dropdown-item{% if request.path == '/breastpump/' %} active{% endif %}"
href="{% url 'core:breastpump-list' %}">
<i class="icon-breastpump" aria-hidden="true"></i>
{% trans "Breastpump" %}
{% if perms.core.view_pumping %}
<a class="dropdown-item{% if request.path == '/pumping/' %} active{% endif %}"
href="{% url 'core:pumping-list' %}">
<i class="icon-pumping" aria-hidden="true"></i>
{% trans "Pumping" %}
</a>
{% endif %}
{% if perms.core.add_breastpump %}
<a class="dropdown-item pl-5{% if request.path == '/breastpump/add/' %} active{% endif %}"
href="{% url 'core:breastpump-add' %}"><i class="icon-add" aria-hidden="true"></i>
{% trans "Breastpump entry" %}
{% if perms.core.add_pumping %}
<a class="dropdown-item pl-5{% if request.path == '/pumping/add/' %} active{% endif %}"
href="{% url 'core:pumping-add' %}"><i class="icon-add" aria-hidden="true"></i>
{% trans "Pumping entry" %}
</a>
{% endif %}

View File

@ -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):

View File

@ -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(

View File

@ -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"),
),

View File

@ -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")

View File

@ -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 %}
<li class="breadcrumb-item"><a href="{% url 'core:breastpump-list' %}">{% trans "Breastpump" %}</a></li>
<li class="breadcrumb-item"><a href="{% url 'core:pumping-list' %}">{% trans "Pumping" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %}
@ -15,6 +15,6 @@
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
{% endblocktrans %}
<input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:breastpump-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
<a href="{% url 'core:pumping-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form>
{% endblock %}

View File

@ -5,16 +5,16 @@
{% if object %}
{{ object }}
{% else %}
{% trans "Add a Breastpump Reading" %}
{% trans "Add a Pumping Reading" %}
{% endif %}
{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:breastpump-list' %}">{% trans "Breastpump" %}</a></li>
<li class="breadcrumb-item"><a href="{% url 'core:pumping-list' %}">{% trans "Pumping" %}</a></li>
{% if object %}
<li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %}
<li class="breadcrumb-item active" aria-current="page">{% trans "Add a Breastpump Reading" %}</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Add a Pumping Reading" %}</li>
{% endif %}
{% endblock %}
@ -24,7 +24,7 @@
<h1>Update <span class="text-info">{{ object }}</span></h1>
{% endblocktrans %}
{% else %}
<h1>{% trans "Add a Breastpump Entry" %}</h1>
<h1>{% trans "Add a Pumping Entry" %}</h1>
{% endif %}
{% include 'babybuddy/form.html' %}
{% endblock %}

View File

@ -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 %}
<li class="breadcrumb-item active" aria-current="page">{% trans "Breastpump" %}</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Pumping" %}</li>
{% endblock %}
{% block content %}
<h1>
{% trans "Breastpump" %}
{% if perms.core.add_breastpump %}
<a href="{% url 'core:breastpump-add' %}" class="btn btn-sm btn-success">
<i class="icon-breastpump" aria-hidden="true"></i> {% trans "Add Breastpump Entry" %}
{% trans "Pumping" %}
{% if perms.core.add_pumping %}
<a href="{% url 'core:pumping-add' %}" class="btn btn-sm btn-success">
<i class="icon-pumping" aria-hidden="true"></i> {% trans "Add Pumping Entry" %}
</a>
{% endif %}
</h1>
@ -30,40 +30,40 @@
</tr>
</thead>
<tbody>
{% for breastpump in object_list %}
{% for pumping in object_list %}
{% cycle "odd" "even" as row_class silent %}
<tr class="{{ row_class }}">
<td>
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_breastpump %}
<a href="{% url 'core:breastpump-update' breastpump.id %}" class="btn btn-primary">
{% if perms.core.change_pumping %}
<a href="{% url 'core:pumping-update' pumping.id %}" class="btn btn-primary">
<i class="icon-update" aria-hidden="true"></i>
</a>
{% endif %}
{% if perms.core.delete_breastpump %}
<a href="{% url 'core:breastpump-delete' breastpump.id %}" class="btn btn-danger">
{% if perms.core.delete_pumping %}
<a href="{% url 'core:pumping-delete' pumping.id %}" class="btn btn-danger">
<i class="icon-delete" aria-hidden="true"></i>
</a>
{% endif %}
</div>
</td>
<th scope="row">{{ breastpump.time|datetime_short }}</th>
<th scope="row">{{ pumping.time|datetime_short }}</th>
{% if not unique_child %}
<td><a href="{% url 'core:child' breastpump.child.slug %}">{{ breastpump.child }}</a></td>
<td><a href="{% url 'core:child' pumping.child.slug %}">{{ pumping.child }}</a></td>
{% endif %}
<td>{{ breastpump.amount }}</td>
<td>{{ pumping.amount }}</td>
</tr>
{% if breastpump.notes %}
{% if pumping.notes %}
<tr class="{{ row_class }} row-details">
<td colspan="4"><i class="icon-note mr-2" aria-hidden="true"></i>{{ breastpump.notes }}</td>
<td colspan="4"><i class="icon-note mr-2" aria-hidden="true"></i>{{ pumping.notes }}</td>
</tr>
{% endif %}
{% empty %}
<tr>
<th colspan="4">{% trans "No breastpump entries found." %}</th>
<th colspan="4">{% trans "No pumping entries found." %}</th>
</tr>
{% endfor %}
</tbody>

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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/<int:pk>/",
views.BreastpumpUpdate.as_view(),
name="breastpump-update",
"pumping/<int:pk>/",
views.PumpingUpdate.as_view(),
name="pumping-update",
),
path(
"breastpump/<int:pk>/delete/",
views.BreastpumpDelete.as_view(),
name="breastpump-delete",
"pumping/<int:pk>/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"),

View File

@ -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):

View File

@ -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/`

View File

@ -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.

View File

@ -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

View File

@ -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"] = _("<b>Breastpump</b>")
layout_args["title"] = _("<b>Pumping</b>")
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)

View File

@ -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 }}
<li class="breadcrumb-item active" aria-current="page">{% trans "Breastpump" %}</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Pumping" %}</li>
{% endblock %}

View File

@ -8,7 +8,7 @@
<h1>Reports</h1>
<div class="list-group">
<a href="{% url 'reports:report-bmi-bmi-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Body Mass Index (BMI)" %}</a>
<a href="{% url 'reports:report-breastpump-amounts-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Breastpump Amounts" %}</a>
<a href="{% url 'reports:report-pumping-amounts-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Pumping Amounts" %}</a>
<a href="{% url 'reports:report-diaperchange-amounts-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Diaper Change Amounts" %}</a>
<a href="{% url 'reports:report-diaperchange-types-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Diaper Change Types" %}</a>
<a href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Diaper Lifetimes" %}</a>

View File

@ -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))

View File

@ -12,9 +12,9 @@ urlpatterns = [
name="report-list",
),
path(
"children/<str:slug>/reports/breastpump/amounts/",
views.BreastpumpAmounts.as_view(),
name="report-breastpump-amounts-child",
"children/<str:slug>/reports/pumping/amounts/",
views.PumpingAmounts.as_view(),
name="report-pumping-amounts-child",
),
path(
"children/<str:slug>/reports/changes/amounts/",

View File

@ -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

View File

@ -86,7 +86,7 @@
<glyph glyph-name="temperature" unicode="&#xf2c8;" d="M357 100q0-45-31-76t-76-31-76 31-31 76q0 34 19 61t52 40v363h72v-363q32-12 52-40t19-61z m72 0q0 43-19 80t-53 63v428q0 45-31 76t-76 32-76-32-31-76v-428q-34-25-53-63t-19-80q0-74 53-126t126-53 126 53 53 126z m71 0q0-103-73-177t-177-73-177 73-73 177q0 102 71 175v396q0 75 53 127t126 52 126-52 53-127v-396q71-73 71-175z m71 321v-71h-107v71h107z m0 143v-71h-107v71h107z m0 143v-71h-107v71h107z" horiz-adv-x="571.4" />
<glyph glyph-name="breastpump" unicode="&#xf392;" d="M290 28c9.333 78.667 29.333 151.667 60 219c30.667 67.333 61.333 120.333 92 159c30.667 38.667 58 84 82 136c24 52 36 105.333 36 160c0 76 -27.667 141.333 -83 196c-55.333 54.667 -121 82 -197 82c-76 0 -141.667 -27.333 -197 -82c-55.333 -54.667 -83 -120 -83 -196c0 -54.667 12 -108 36 -160c24 -52 51.333 -97.333 82 -136c30.667 -38.667 61.333 -91.667 92 -159c30.667 -67.333 50.667 -140.333 60 -219c1.333 -5.333 5 -8 11 -8c6 0 9 2.667 9 8c0 0 0 0 0 0m-42 392c1.333 -2.667 0.667 -7.333 -2 -14c-4 -4 -8.667 -6 -14 -6c-5.333 0 -9.333 2 -12 6c0 0 -40 58 -40 58c-21.333 30.667 -37.333 54 -48 70c-10.667 16 -22 41 -34 75c-12 34 -18 67.667 -18 101c0 16 5.667 29.667 17 41c11.333 11.333 25 17 41 17c38.667 0 58 -22.667 58 -68c0 -62.667 14 -144.667 42 -246c1.333 -4 3 -9.667 5 -17c2 -7.333 3.667 -13 5 -17c0 0 0 0 0 0" horiz-adv-x="571.4" />
<glyph glyph-name="pumping" unicode="&#xf392;" d="M290 28c9.333 78.667 29.333 151.667 60 219c30.667 67.333 61.333 120.333 92 159c30.667 38.667 58 84 82 136c24 52 36 105.333 36 160c0 76 -27.667 141.333 -83 196c-55.333 54.667 -121 82 -197 82c-76 0 -141.667 -27.333 -197 -82c-55.333 -54.667 -83 -120 -83 -196c0 -54.667 12 -108 36 -160c24 -52 51.333 -97.333 82 -136c30.667 -38.667 61.333 -91.667 92 -159c30.667 -67.333 50.667 -140.333 60 -219c1.333 -5.333 5 -8 11 -8c6 0 9 2.667 9 8c0 0 0 0 0 0m-42 392c1.333 -2.667 0.667 -7.333 -2 -14c-4 -4 -8.667 -6 -14 -6c-5.333 0 -9.333 2 -12 6c0 0 -40 58 -40 58c-21.333 30.667 -37.333 54 -48 70c-10.667 16 -22 41 -34 75c-12 34 -18 67.667 -18 101c0 16 5.667 29.667 17 41c11.333 11.333 25 17 41 17c38.667 0 58 -22.667 58 -68c0 -62.667 14 -144.667 42 -246c1.333 -4 3 -9.667 5 -17c2 -7.333 3.667 -13 5 -17c0 0 0 0 0 0" horiz-adv-x="571.4" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -86,7 +86,7 @@
<glyph glyph-name="temperature" unicode="&#xf2c8;" d="M357 100q0-45-31-76t-76-31-76 31-31 76q0 34 19 61t52 40v363h72v-363q32-12 52-40t19-61z m72 0q0 43-19 80t-53 63v428q0 45-31 76t-76 32-76-32-31-76v-428q-34-25-53-63t-19-80q0-74 53-126t126-53 126 53 53 126z m71 0q0-103-73-177t-177-73-177 73-73 177q0 102 71 175v396q0 75 53 127t126 52 126-52 53-127v-396q71-73 71-175z m71 321v-71h-107v71h107z m0 143v-71h-107v71h107z m0 143v-71h-107v71h107z" horiz-adv-x="571.4" />
<glyph glyph-name="breastpump" unicode="&#xf392;" d="M290 28c9.333 78.667 29.333 151.667 60 219c30.667 67.333 61.333 120.333 92 159c30.667 38.667 58 84 82 136c24 52 36 105.333 36 160c0 76 -27.667 141.333 -83 196c-55.333 54.667 -121 82 -197 82c-76 0 -141.667 -27.333 -197 -82c-55.333 -54.667 -83 -120 -83 -196c0 -54.667 12 -108 36 -160c24 -52 51.333 -97.333 82 -136c30.667 -38.667 61.333 -91.667 92 -159c30.667 -67.333 50.667 -140.333 60 -219c1.333 -5.333 5 -8 11 -8c6 0 9 2.667 9 8c0 0 0 0 0 0m-42 392c1.333 -2.667 0.667 -7.333 -2 -14c-4 -4 -8.667 -6 -14 -6c-5.333 0 -9.333 2 -12 6c0 0 -40 58 -40 58c-21.333 30.667 -37.333 54 -48 70c-10.667 16 -22 41 -34 75c-12 34 -18 67.667 -18 101c0 16 5.667 29.667 17 41c11.333 11.333 25 17 41 17c38.667 0 58 -22.667 58 -68c0 -62.667 14 -144.667 42 -246c1.333 -4 3 -9.667 5 -17c2 -7.333 3.667 -13 5 -17c0 0 0 0 0 0" horiz-adv-x="571.4" />
<glyph glyph-name="pumping" unicode="&#xf392;" d="M290 28c9.333 78.667 29.333 151.667 60 219c30.667 67.333 61.333 120.333 92 159c30.667 38.667 58 84 82 136c24 52 36 105.333 36 160c0 76 -27.667 141.333 -83 196c-55.333 54.667 -121 82 -197 82c-76 0 -141.667 -27.333 -197 -82c-55.333 -54.667 -83 -120 -83 -196c0 -54.667 12 -108 36 -160c24 -52 51.333 -97.333 82 -136c30.667 -38.667 61.333 -91.667 92 -159c30.667 -67.333 50.667 -140.333 60 -219c1.333 -5.333 5 -8 11 -8c6 0 9 2.667 9 8c0 0 0 0 0 0m-42 392c1.333 -2.667 0.667 -7.333 -2 -14c-4 -4 -8.667 -6 -14 -6c-5.333 0 -9.333 2 -12 6c0 0 -40 58 -40 58c-21.333 30.667 -37.333 54 -48 70c-10.667 16 -22 41 -34 75c-12 34 -18 67.667 -18 101c0 16 5.667 29.667 17 41c11.333 11.333 25 17 41 17c38.667 0 58 -22.667 58 -68c0 -62.667 14 -144.667 42 -246c1.333 -4 3 -9.667 5 -17c2 -7.333 3.667 -13 5 -17c0 0 0 0 0 0" horiz-adv-x="571.4" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB