mirror of https://github.com/snachodog/mybuddy.git
Rename breastpump to pumping
This commit is contained in:
parent
ca89797dd0
commit
4ceb6095d3
|
@ -63,9 +63,9 @@ class StartEndFieldFilter(ChildFieldFilter):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpFilter(TimeFieldFilter):
|
class PumpingFilter(TimeFieldFilter):
|
||||||
class Meta(TimeFieldFilter.Meta):
|
class Meta(TimeFieldFilter.Meta):
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
|
|
||||||
|
|
||||||
class DiaperChangeFilter(TimeFieldFilter, TagsFieldFilter):
|
class DiaperChangeFilter(TimeFieldFilter, TagsFieldFilter):
|
||||||
|
|
|
@ -102,9 +102,9 @@ class UserSerializer(serializers.ModelSerializer):
|
||||||
fields = ("id", "username")
|
fields = ("id", "username")
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpSerializer(CoreModelSerializer):
|
class PumpingSerializer(CoreModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
fields = ("id", "child", "amount", "time", "notes")
|
fields = ("id", "child", "amount", "time", "notes")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -129,9 +129,9 @@ class ChildAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
|
||||||
self.assertEqual(response.data, entry)
|
self.assertEqual(response.data, entry)
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
|
class PumpingAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
|
||||||
endpoint = reverse("api:breastpump-list")
|
endpoint = reverse("api:pumping-list")
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
response = self.client.get(self.endpoint)
|
response = self.client.get(self.endpoint)
|
||||||
|
@ -156,7 +156,7 @@ class BreastpumpAPITestCase(TestBase.BabyBuddyAPITestCaseBase):
|
||||||
}
|
}
|
||||||
response = self.client.post(self.endpoint, data, format="json")
|
response = self.client.post(self.endpoint, data, format="json")
|
||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
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(str(obj.amount), data["amount"])
|
||||||
self.assertEqual(obj.notes, data["notes"])
|
self.assertEqual(obj.notes, data["notes"])
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ router.register(r"changes", views.DiaperChangeViewSet)
|
||||||
router.register(r"feedings", views.FeedingViewSet)
|
router.register(r"feedings", views.FeedingViewSet)
|
||||||
router.register(r"notes", views.NoteViewSet)
|
router.register(r"notes", views.NoteViewSet)
|
||||||
router.register(r"sleep", views.SleepViewSet)
|
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"temperature", views.TemperatureViewSet)
|
||||||
router.register(r"timers", views.TimerViewSet)
|
router.register(r"timers", views.TimerViewSet)
|
||||||
router.register(r"tummy-times", views.TummyTimeViewSet)
|
router.register(r"tummy-times", views.TummyTimeViewSet)
|
||||||
|
|
|
@ -16,10 +16,10 @@ class ChildViewSet(viewsets.ModelViewSet):
|
||||||
filterset_fields = ("first_name", "last_name", "slug", "birth_date")
|
filterset_fields = ("first_name", "last_name", "slug", "birth_date")
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpViewSet(viewsets.ModelViewSet):
|
class PumpingViewSet(viewsets.ModelViewSet):
|
||||||
queryset = models.Breastpump.objects.all()
|
queryset = models.Pumping.objects.all()
|
||||||
serializer_class = serializers.BreastpumpSerializer
|
serializer_class = serializers.PumpingSerializer
|
||||||
filterset_class = filters.BreastpumpFilter
|
filterset_class = filters.PumpingFilter
|
||||||
|
|
||||||
|
|
||||||
class DiaperChangeViewSet(viewsets.ModelViewSet):
|
class DiaperChangeViewSet(viewsets.ModelViewSet):
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"model": "core.breastpump",
|
"model": "core.pumping",
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
"fields":
|
"fields":
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,8 +75,8 @@ class Command(BaseCommand):
|
||||||
"""
|
"""
|
||||||
self.time = self.child.birth_date
|
self.time = self.child.birth_date
|
||||||
|
|
||||||
self.breastpump = round(uniform(95.0, 102.0), 2)
|
self.pumping = round(uniform(95.0, 102.0), 2)
|
||||||
self._add_breastpump_entry()
|
self._add_pumping_entry()
|
||||||
|
|
||||||
self.temperature = round(uniform(95.0, 102.0), 2)
|
self.temperature = round(uniform(95.0, 102.0), 2)
|
||||||
self._add_temperature_entry()
|
self._add_temperature_entry()
|
||||||
|
@ -106,7 +106,7 @@ class Command(BaseCommand):
|
||||||
self._add_diaperchange_entry()
|
self._add_diaperchange_entry()
|
||||||
self._add_feeding_entry()
|
self._add_feeding_entry()
|
||||||
self._add_diaperchange_entry()
|
self._add_diaperchange_entry()
|
||||||
self._add_breastpump_entry()
|
self._add_pumping_entry()
|
||||||
if choice([True, False]):
|
if choice([True, False]):
|
||||||
self._add_tummytime_entry()
|
self._add_tummytime_entry()
|
||||||
if choice([True, False]):
|
if choice([True, False]):
|
||||||
|
@ -115,7 +115,7 @@ class Command(BaseCommand):
|
||||||
if choice([True, False]):
|
if choice([True, False]):
|
||||||
self._add_temperature_entry()
|
self._add_temperature_entry()
|
||||||
if choice([True, False]):
|
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]):
|
if (self.time - last_note_entry_time).days > 1 and choice([True, False]):
|
||||||
self._add_note_entry()
|
self._add_note_entry()
|
||||||
last_note_entry_time = self.time
|
last_note_entry_time = self.time
|
||||||
|
@ -133,9 +133,9 @@ class Command(BaseCommand):
|
||||||
last_bmi_entry_time = self.time
|
last_bmi_entry_time = self.time
|
||||||
|
|
||||||
@transaction.atomic
|
@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:
|
:returns:
|
||||||
"""
|
"""
|
||||||
self.amount = round(uniform(95.0, 102.0), 2)
|
self.amount = round(uniform(95.0, 102.0), 2)
|
||||||
|
@ -144,7 +144,7 @@ class Command(BaseCommand):
|
||||||
if choice([True, False, False, False]):
|
if choice([True, False, False, False]):
|
||||||
notes = " ".join(self.faker.sentences(randint(1, 5)))
|
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
|
child=self.child, amount=self.amount, time=self.time, notes=notes
|
||||||
).save()
|
).save()
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uid": "4efb719e797c54b3c58e5ae061d29d53",
|
"uid": "4efb719e797c54b3c58e5ae061d29d53",
|
||||||
"css": "breastpump",
|
"css": "pumping",
|
||||||
"code": 62631,
|
"code": 62631,
|
||||||
"src": "entypo"
|
"src": "entypo"
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,4 +39,4 @@
|
||||||
.icon-today:before { content: '\f274'; } /* '' */
|
.icon-today:before { content: '\f274'; } /* '' */
|
||||||
.icon-bmi:before { content: '\f295'; } /* '' */
|
.icon-bmi:before { content: '\f295'; } /* '' */
|
||||||
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
||||||
.icon-breastpump:before { content: '\f4a7'; } /* '' */
|
.icon-pumping:before { content: '\f4a7'; } /* '' */
|
||||||
|
|
|
@ -97,4 +97,4 @@
|
||||||
.icon-today:before { content: '\f274'; } /* '' */
|
.icon-today:before { content: '\f274'; } /* '' */
|
||||||
.icon-bmi:before { content: '\f295'; } /* '' */
|
.icon-bmi:before { content: '\f295'; } /* '' */
|
||||||
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
||||||
.icon-breastpump:before { content: '\f4a7'; } /* '' */
|
.icon-pumping:before { content: '\f4a7'; } /* '' */
|
||||||
|
|
|
@ -39,4 +39,4 @@
|
||||||
.icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
.icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||||
.icon-bmi { *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-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 = ' '); }
|
||||||
|
|
|
@ -50,4 +50,4 @@
|
||||||
.icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
.icon-today { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); }
|
||||||
.icon-bmi { *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-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 = ' '); }
|
||||||
|
|
|
@ -94,4 +94,4 @@
|
||||||
.icon-today:before { content: '\f274'; } /* '' */
|
.icon-today:before { content: '\f274'; } /* '' */
|
||||||
.icon-bmi:before { content: '\f295'; } /* '' */
|
.icon-bmi:before { content: '\f295'; } /* '' */
|
||||||
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
.icon-temperature:before { content: '\f2c8'; } /* '' */
|
||||||
.icon-breastpump:before { content: '\f4a7'; } /* '' */
|
.icon-pumping:before { content: '\f4a7'; } /* '' */
|
||||||
|
|
|
@ -352,7 +352,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span3" title="Code: 0xf4a7">
|
<div class="span3" title="Code: 0xf4a7">
|
||||||
<i class="demo-icon icon-breastpump"></i> <span class="i-name">icon-breastpump</span><span class="i-code">0xf4a7</span>
|
<i class="demo-icon icon-pumping"></i> <span class="i-name">icon-pumping</span><span class="i-code">0xf4a7</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container footer">Generated by <a href="https://fontello.com">fontello.com</a></div>
|
<div class="container footer">Generated by <a href="https://fontello.com">fontello.com</a></div>
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
<glyph glyph-name="temperature" unicode="" 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="temperature" unicode="" 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="" 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="" 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>
|
</font>
|
||||||
</defs>
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -87,10 +87,10 @@
|
||||||
{% trans "Weight" %}
|
{% trans "Weight" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.core.add_breastpump %}
|
{% if perms.core.add_pumping %}
|
||||||
<a class="dropdown-item p-2" href="{% url 'core:breastpump-add' %}">
|
<a class="dropdown-item p-2" href="{% url 'core:pumping-add' %}">
|
||||||
<i class="icon-breastpump" aria-hidden="true"></i>
|
<i class="icon-pumping" aria-hidden="true"></i>
|
||||||
{% trans "Breastpump" %}
|
{% trans "Pumping" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -241,17 +241,17 @@
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if perms.core.view_breastpump %}
|
{% if perms.core.view_pumping %}
|
||||||
<a class="dropdown-item{% if request.path == '/breastpump/' %} active{% endif %}"
|
<a class="dropdown-item{% if request.path == '/pumping/' %} active{% endif %}"
|
||||||
href="{% url 'core:breastpump-list' %}">
|
href="{% url 'core:pumping-list' %}">
|
||||||
<i class="icon-breastpump" aria-hidden="true"></i>
|
<i class="icon-pumping" aria-hidden="true"></i>
|
||||||
{% trans "Breastpump" %}
|
{% trans "Pumping" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.core.add_breastpump %}
|
{% if perms.core.add_pumping %}
|
||||||
<a class="dropdown-item pl-5{% if request.path == '/breastpump/add/' %} active{% endif %}"
|
<a class="dropdown-item pl-5{% if request.path == '/pumping/add/' %} active{% endif %}"
|
||||||
href="{% url 'core:breastpump-add' %}"><i class="icon-add" aria-hidden="true"></i>
|
href="{% url 'core:pumping-add' %}"><i class="icon-add" aria-hidden="true"></i>
|
||||||
{% trans "Breastpump entry" %}
|
{% trans "Pumping entry" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,13 @@ class ChildAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin):
|
||||||
resource_class = ChildImportExportResource
|
resource_class = ChildImportExportResource
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpImportExportResource(ImportExportResourceBase):
|
class PumpingImportExportResource(ImportExportResourceBase):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.Breastpump)
|
@admin.register(models.Pumping)
|
||||||
class BreastpumpAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin):
|
class PumpingAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin):
|
||||||
list_display = (
|
list_display = (
|
||||||
"child",
|
"child",
|
||||||
"amount",
|
"amount",
|
||||||
|
@ -76,7 +76,7 @@ class BreastpumpAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin):
|
||||||
"child__last_name",
|
"child__last_name",
|
||||||
"amount",
|
"amount",
|
||||||
)
|
)
|
||||||
resource_class = BreastpumpImportExportResource
|
resource_class = PumpingImportExportResource
|
||||||
|
|
||||||
|
|
||||||
class DiaperChangeImportExportResource(ImportExportResourceBase):
|
class DiaperChangeImportExportResource(ImportExportResourceBase):
|
||||||
|
|
|
@ -124,9 +124,9 @@ class ChildDeleteForm(forms.ModelForm):
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpForm(CoreModelForm):
|
class PumpingForm(CoreModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
fields = ["child", "amount", "time", "notes"]
|
fields = ["child", "amount", "time", "notes"]
|
||||||
widgets = {
|
widgets = {
|
||||||
"time": forms.DateTimeInput(
|
"time": forms.DateTimeInput(
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Breastpump",
|
name="Pumping",
|
||||||
fields=[
|
fields=[
|
||||||
(
|
(
|
||||||
"id",
|
"id",
|
||||||
|
@ -29,21 +29,21 @@ class Migration(migrations.Migration):
|
||||||
"child",
|
"child",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
related_name="breastpump",
|
related_name="pumping",
|
||||||
to="core.Child",
|
to="core.Child",
|
||||||
verbose_name="Child",
|
verbose_name="Child",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
"verbose_name": "Breastpump",
|
"verbose_name": "Pumping",
|
||||||
"verbose_name_plural": "Breastpump",
|
"verbose_name_plural": "Pumping",
|
||||||
"ordering": ["-time"],
|
"ordering": ["-time"],
|
||||||
"default_permissions": ("view", "add", "change", "delete"),
|
"default_permissions": ("view", "add", "change", "delete"),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="breastpump",
|
model_name="pumping",
|
||||||
name="notes",
|
name="notes",
|
||||||
field=models.TextField(blank=True, null=True, verbose_name="Notes"),
|
field=models.TextField(blank=True, null=True, verbose_name="Notes"),
|
||||||
),
|
),
|
|
@ -173,12 +173,12 @@ class TaggableManager(TaggitTaggableManager):
|
||||||
return super().formfield(*args, **kwargs)
|
return super().formfield(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Breastpump(models.Model):
|
class Pumping(models.Model):
|
||||||
model_name = "breastpump"
|
model_name = "pumping"
|
||||||
child = models.ForeignKey(
|
child = models.ForeignKey(
|
||||||
"Child",
|
"Child",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
related_name="breastpump",
|
related_name="pumping",
|
||||||
verbose_name=_("Child"),
|
verbose_name=_("Child"),
|
||||||
)
|
)
|
||||||
amount = models.FloatField(blank=False, null=False, verbose_name=_("Amount"))
|
amount = models.FloatField(blank=False, null=False, verbose_name=_("Amount"))
|
||||||
|
@ -190,11 +190,11 @@ class Breastpump(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
default_permissions = ("view", "add", "change", "delete")
|
default_permissions = ("view", "add", "change", "delete")
|
||||||
ordering = ["-time"]
|
ordering = ["-time"]
|
||||||
verbose_name = _("Breastpump")
|
verbose_name = _("Pumping")
|
||||||
verbose_name_plural = _("Breastpump")
|
verbose_name_plural = _("Pumping")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(_("Breastpump"))
|
return str(_("Pumping"))
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
validate_time(self.time, "time")
|
validate_time(self.time, "time")
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{% extends 'babybuddy/page.html' %}
|
{% extends 'babybuddy/page.html' %}
|
||||||
{% load i18n widget_tweaks %}
|
{% load i18n widget_tweaks %}
|
||||||
|
|
||||||
{% block title %}{% trans "Delete a Breastpump Reading" %}{% endblock %}
|
{% block title %}{% trans "Delete a Pumping Reading" %}{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% 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>
|
<li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -15,6 +15,6 @@
|
||||||
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
<input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
|
<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>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -5,16 +5,16 @@
|
||||||
{% if object %}
|
{% if object %}
|
||||||
{{ object }}
|
{{ object }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "Add a Breastpump Reading" %}
|
{% trans "Add a Pumping Reading" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% 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 %}
|
{% if object %}
|
||||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
|
<li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
<h1>Update <span class="text-info">{{ object }}</span></h1>
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1>{% trans "Add a Breastpump Entry" %}</h1>
|
<h1>{% trans "Add a Pumping Entry" %}</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'babybuddy/form.html' %}
|
{% include 'babybuddy/form.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,18 +1,18 @@
|
||||||
{% extends 'babybuddy/page.html' %}
|
{% extends 'babybuddy/page.html' %}
|
||||||
{% load datetime i18n widget_tweaks %}
|
{% load datetime i18n widget_tweaks %}
|
||||||
|
|
||||||
{% block title %}{% trans "Breastpump" %}{% endblock %}
|
{% block title %}{% trans "Pumping" %}{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>
|
<h1>
|
||||||
{% trans "Breastpump" %}
|
{% trans "Pumping" %}
|
||||||
{% if perms.core.add_breastpump %}
|
{% if perms.core.add_pumping %}
|
||||||
<a href="{% url 'core:breastpump-add' %}" class="btn btn-sm btn-success">
|
<a href="{% url 'core:pumping-add' %}" class="btn btn-sm btn-success">
|
||||||
<i class="icon-breastpump" aria-hidden="true"></i> {% trans "Add Breastpump Entry" %}
|
<i class="icon-pumping" aria-hidden="true"></i> {% trans "Add Pumping Entry" %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -30,40 +30,40 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for breastpump in object_list %}
|
{% for pumping in object_list %}
|
||||||
{% cycle "odd" "even" as row_class silent %}
|
{% cycle "odd" "even" as row_class silent %}
|
||||||
<tr class="{{ row_class }}">
|
<tr class="{{ row_class }}">
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
|
||||||
|
|
||||||
{% if perms.core.change_breastpump %}
|
{% if perms.core.change_pumping %}
|
||||||
<a href="{% url 'core:breastpump-update' breastpump.id %}" class="btn btn-primary">
|
<a href="{% url 'core:pumping-update' pumping.id %}" class="btn btn-primary">
|
||||||
<i class="icon-update" aria-hidden="true"></i>
|
<i class="icon-update" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if perms.core.delete_breastpump %}
|
{% if perms.core.delete_pumping %}
|
||||||
<a href="{% url 'core:breastpump-delete' breastpump.id %}" class="btn btn-danger">
|
<a href="{% url 'core:pumping-delete' pumping.id %}" class="btn btn-danger">
|
||||||
<i class="icon-delete" aria-hidden="true"></i>
|
<i class="icon-delete" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th scope="row">{{ breastpump.time|datetime_short }}</th>
|
<th scope="row">{{ pumping.time|datetime_short }}</th>
|
||||||
{% if not unique_child %}
|
{% 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 %}
|
{% endif %}
|
||||||
<td>{{ breastpump.amount }}</td>
|
<td>{{ pumping.amount }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if breastpump.notes %}
|
{% if pumping.notes %}
|
||||||
<tr class="{{ row_class }} row-details">
|
<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>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4">{% trans "No breastpump entries found." %}</th>
|
<th colspan="4">{% trans "No pumping entries found." %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
|
@ -194,11 +194,11 @@ class ChildFormsTestCase(FormsTestCaseBase):
|
||||||
self.assertContains(page, "Child entry deleted")
|
self.assertContains(page, "Child entry deleted")
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpFormsTestCase(FormsTestCaseBase):
|
class PumpingFormsTestCase(FormsTestCaseBase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(BreastpumpFormsTestCase, cls).setUpClass()
|
super(PumpingFormsTestCase, cls).setUpClass()
|
||||||
cls.bp = models.Breastpump.objects.create(
|
cls.bp = models.Pumping.objects.create(
|
||||||
child=cls.child,
|
child=cls.child,
|
||||||
amount=50.0,
|
amount=50.0,
|
||||||
time=timezone.localtime() - timezone.timedelta(days=1),
|
time=timezone.localtime() - timezone.timedelta(days=1),
|
||||||
|
@ -211,10 +211,10 @@ class BreastpumpFormsTestCase(FormsTestCaseBase):
|
||||||
"time": self.localtime_string(),
|
"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.assertEqual(page.status_code, 200)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
page, "Breastpump entry for {} added".format(str(self.child))
|
page, "Pumping entry for {} added".format(str(self.child))
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_edit(self):
|
def test_edit(self):
|
||||||
|
@ -223,18 +223,18 @@ class BreastpumpFormsTestCase(FormsTestCaseBase):
|
||||||
"amount": self.bp.amount + 2,
|
"amount": self.bp.amount + 2,
|
||||||
"time": self.localtime_string(),
|
"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.assertEqual(page.status_code, 200)
|
||||||
self.bp.refresh_from_db()
|
self.bp.refresh_from_db()
|
||||||
self.assertEqual(self.bp.amount, params["amount"])
|
self.assertEqual(self.bp.amount, params["amount"])
|
||||||
self.assertContains(
|
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):
|
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.assertEqual(page.status_code, 200)
|
||||||
self.assertContains(page, "Breastpump entry deleted")
|
self.assertContains(page, "Pumping entry deleted")
|
||||||
|
|
||||||
|
|
||||||
class DiaperChangeFormsTestCase(FormsTestCaseBase):
|
class DiaperChangeFormsTestCase(FormsTestCaseBase):
|
||||||
|
|
|
@ -41,8 +41,8 @@ class ImportTestCase(TestCase):
|
||||||
def test_child(self):
|
def test_child(self):
|
||||||
self.import_data(models.Child, 2)
|
self.import_data(models.Child, 2)
|
||||||
|
|
||||||
def test_breastpump(self):
|
def test_pumping(self):
|
||||||
self.import_data(models.Breastpump, 23)
|
self.import_data(models.Pumping, 23)
|
||||||
|
|
||||||
def test_diaperchange(self):
|
def test_diaperchange(self):
|
||||||
self.import_data(models.DiaperChange, 75)
|
self.import_data(models.DiaperChange, 75)
|
||||||
|
|
|
@ -35,21 +35,21 @@ class ChildTestCase(TestCase):
|
||||||
self.assertEqual(models.Child.count(), 1)
|
self.assertEqual(models.Child.count(), 1)
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpTestCase(TestCase):
|
class PumpingTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
call_command("migrate", verbosity=0)
|
call_command("migrate", verbosity=0)
|
||||||
self.child = models.Child.objects.create(
|
self.child = models.Child.objects.create(
|
||||||
first_name="First", last_name="Last", birth_date=timezone.localdate()
|
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,
|
child=self.child,
|
||||||
time=timezone.localtime() - timezone.timedelta(days=1),
|
time=timezone.localtime() - timezone.timedelta(days=1),
|
||||||
amount=98.6,
|
amount=98.6,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_breastpump_create(self):
|
def test_pumping_create(self):
|
||||||
self.assertEqual(self.temp, models.Breastpump.objects.first())
|
self.assertEqual(self.temp, models.Pumping.objects.first())
|
||||||
self.assertEqual(str(self.temp), "Breastpump")
|
self.assertEqual(str(self.temp), "Pumping")
|
||||||
self.assertEqual(self.temp.amount, 98.6)
|
self.assertEqual(self.temp.amount, 98.6)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,16 @@ class ViewsTestCase(TestCase):
|
||||||
page = self.c.get("/children/{}/delete/".format(entry.slug))
|
page = self.c.get("/children/{}/delete/".format(entry.slug))
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
||||||
def test_breastpump_views(self):
|
def test_pumping_views(self):
|
||||||
page = self.c.get("/breastpump/")
|
page = self.c.get("/pumping/")
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
page = self.c.get("/breastpump/add/")
|
page = self.c.get("/pumping/add/")
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
||||||
entry = models.Breastpump.objects.first()
|
entry = models.Pumping.objects.first()
|
||||||
page = self.c.get("/breastpump/{}/".format(entry.id))
|
page = self.c.get("/pumping/{}/".format(entry.id))
|
||||||
self.assertEqual(page.status_code, 200)
|
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)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
||||||
def test_diaperchange_views(self):
|
def test_diaperchange_views(self):
|
||||||
|
|
16
core/urls.py
16
core/urls.py
|
@ -6,17 +6,17 @@ from . import views
|
||||||
app_name = "core"
|
app_name = "core"
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("breastpump/", views.BreastpumpList.as_view(), name="breastpump-list"),
|
path("pumping/", views.PumpingList.as_view(), name="pumping-list"),
|
||||||
path("breastpump/add/", views.BreastpumpAdd.as_view(), name="breastpump-add"),
|
path("pumping/add/", views.PumpingAdd.as_view(), name="pumping-add"),
|
||||||
path(
|
path(
|
||||||
"breastpump/<int:pk>/",
|
"pumping/<int:pk>/",
|
||||||
views.BreastpumpUpdate.as_view(),
|
views.PumpingUpdate.as_view(),
|
||||||
name="breastpump-update",
|
name="pumping-update",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"breastpump/<int:pk>/delete/",
|
"pumping/<int:pk>/delete/",
|
||||||
views.BreastpumpDelete.as_view(),
|
views.PumpingDelete.as_view(),
|
||||||
name="breastpump-delete",
|
name="pumping-delete",
|
||||||
),
|
),
|
||||||
path("children/", views.ChildList.as_view(), name="child-list"),
|
path("children/", views.ChildList.as_view(), name="child-list"),
|
||||||
path("children/add/", views.ChildAdd.as_view(), name="child-add"),
|
path("children/add/", views.ChildAdd.as_view(), name="child-add"),
|
||||||
|
|
|
@ -121,34 +121,34 @@ class ChildDelete(CoreUpdateView):
|
||||||
return success_message % cleaned_data
|
return success_message % cleaned_data
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpList(PermissionRequiredMixin, BabyBuddyFilterView):
|
class PumpingList(PermissionRequiredMixin, BabyBuddyFilterView):
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
template_name = "core/breastpump_list.html"
|
template_name = "core/pumping_list.html"
|
||||||
permission_required = ("core.view_breastpump",)
|
permission_required = ("core.view_pumping",)
|
||||||
paginate_by = 10
|
paginate_by = 10
|
||||||
filterset_fields = ("child",)
|
filterset_fields = ("child",)
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpAdd(CoreAddView):
|
class PumpingAdd(CoreAddView):
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
permission_required = ("core.add_breastpump",)
|
permission_required = ("core.add_pumping",)
|
||||||
form_class = forms.BreastpumpForm
|
form_class = forms.PumpingForm
|
||||||
success_url = reverse_lazy("core:breastpump-list")
|
success_url = reverse_lazy("core:pumping-list")
|
||||||
success_message = _("%(model)s reading added!")
|
success_message = _("%(model)s reading added!")
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpUpdate(CoreUpdateView):
|
class PumpingUpdate(CoreUpdateView):
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
permission_required = ("core.change_breastpump",)
|
permission_required = ("core.change_pumping",)
|
||||||
form_class = forms.BreastpumpForm
|
form_class = forms.PumpingForm
|
||||||
success_url = reverse_lazy("core:breastpump-list")
|
success_url = reverse_lazy("core:pumping-list")
|
||||||
success_message = _("%(model)s reading for %(child)s updated.")
|
success_message = _("%(model)s reading for %(child)s updated.")
|
||||||
|
|
||||||
|
|
||||||
class BreastpumpDelete(CoreDeleteView):
|
class PumpingDelete(CoreDeleteView):
|
||||||
model = models.Breastpump
|
model = models.Pumping
|
||||||
permission_required = ("core.delete_breastpump",)
|
permission_required = ("core.delete_pumping",)
|
||||||
success_url = reverse_lazy("core:breastpump-list")
|
success_url = reverse_lazy("core:pumping-list")
|
||||||
|
|
||||||
|
|
||||||
class DiaperChangeList(PermissionRequiredMixin, BabyBuddyFilterView):
|
class DiaperChangeList(PermissionRequiredMixin, BabyBuddyFilterView):
|
||||||
|
|
|
@ -11,7 +11,7 @@ authorization.
|
||||||
Currently, the following endpoints are available for `GET`, `OPTIONS`, and
|
Currently, the following endpoints are available for `GET`, `OPTIONS`, and
|
||||||
`POST` requests:
|
`POST` requests:
|
||||||
|
|
||||||
- `/api/breastpump/`
|
- `/api/pumping/`
|
||||||
- `/api/children/`
|
- `/api/children/`
|
||||||
- `/api/changes/` (Diaper Changes)
|
- `/api/changes/` (Diaper Changes)
|
||||||
- `/api/feedings/`
|
- `/api/feedings/`
|
||||||
|
|
|
@ -45,7 +45,7 @@ ability to edit any entry.
|
||||||
|
|
||||||
The Measurements menu provides the option to view and track your baby's
|
The Measurements menu provides the option to view and track your baby's
|
||||||
measurements of temperature, weight, height, head circumference and BMI.
|
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
|
Selecting any of the measurements will open that specific page with all related
|
||||||
measurements listed.
|
measurements listed.
|
||||||
|
|
|
@ -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_amounts import diaperchange_amounts # NOQA
|
||||||
from .diaperchange_lifetimes import diaperchange_lifetimes # NOQA
|
from .diaperchange_lifetimes import diaperchange_lifetimes # NOQA
|
||||||
from .diaperchange_types import diaperchange_types # NOQA
|
from .diaperchange_types import diaperchange_types # NOQA
|
||||||
|
|
|
@ -8,16 +8,16 @@ import plotly.graph_objs as go
|
||||||
from reports import utils
|
from reports import utils
|
||||||
|
|
||||||
|
|
||||||
def breastpump_amounts(objects):
|
def pumping_amounts(objects):
|
||||||
"""
|
"""
|
||||||
Create a graph showing breastpump amounts over time.
|
Create a graph showing pumping amounts over time.
|
||||||
:param instances: a QuerySet of Breastpump instances.
|
:param instances: a QuerySet of Pumping instances.
|
||||||
:returns: a tuple of the the graph's html and javascript.
|
:returns: a tuple of the the graph's html and javascript.
|
||||||
"""
|
"""
|
||||||
objects = objects.order_by("-time")
|
objects = objects.order_by("-time")
|
||||||
|
|
||||||
trace = go.Scatter(
|
trace = go.Scatter(
|
||||||
name=_("Breastpump"),
|
name=_("Pumping"),
|
||||||
x=list(objects.values_list("time", flat=True)),
|
x=list(objects.values_list("time", flat=True)),
|
||||||
y=list(objects.values_list("amount", flat=True)),
|
y=list(objects.values_list("amount", flat=True)),
|
||||||
fill="tozeroy",
|
fill="tozeroy",
|
||||||
|
@ -25,10 +25,10 @@ def breastpump_amounts(objects):
|
||||||
|
|
||||||
layout_args = utils.default_graph_layout_options()
|
layout_args = utils.default_graph_layout_options()
|
||||||
layout_args["barmode"] = "stack"
|
layout_args["barmode"] = "stack"
|
||||||
layout_args["title"] = _("<b>Breastpump</b>")
|
layout_args["title"] = _("<b>Pumping</b>")
|
||||||
layout_args["xaxis"]["title"] = _("Date")
|
layout_args["xaxis"]["title"] = _("Date")
|
||||||
layout_args["xaxis"]["rangeselector"] = utils.rangeselector_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)})
|
fig = go.Figure({"data": [trace], "layout": go.Layout(**layout_args)})
|
||||||
output = plotly.plot(fig, output_type="div", include_plotlyjs=False)
|
output = plotly.plot(fig, output_type="div", include_plotlyjs=False)
|
|
@ -1,9 +1,9 @@
|
||||||
{% extends 'reports/report_base.html' %}
|
{% extends 'reports/report_base.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Breastpump" %} - {{ object }}{% endblock %}
|
{% block title %}{% trans "Pumping" %} - {{ object }}{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ block.super }}
|
{{ 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 %}
|
{% endblock %}
|
|
@ -8,7 +8,7 @@
|
||||||
<h1>Reports</h1>
|
<h1>Reports</h1>
|
||||||
<div class="list-group">
|
<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-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-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-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>
|
<a href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Diaper Lifetimes" %}</a>
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ViewsTestCase(TestCase):
|
||||||
page = self.c.get(base_url)
|
page = self.c.get(base_url)
|
||||||
self.assertEqual(page.status_code, 200)
|
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)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
||||||
page = self.c.get("{}/changes/amounts/".format(base_url))
|
page = self.c.get("{}/changes/amounts/".format(base_url))
|
||||||
|
|
|
@ -12,9 +12,9 @@ urlpatterns = [
|
||||||
name="report-list",
|
name="report-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"children/<str:slug>/reports/breastpump/amounts/",
|
"children/<str:slug>/reports/pumping/amounts/",
|
||||||
views.BreastpumpAmounts.as_view(),
|
views.PumpingAmounts.as_view(),
|
||||||
name="report-breastpump-amounts-child",
|
name="report-pumping-amounts-child",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"children/<str:slug>/reports/changes/amounts/",
|
"children/<str:slug>/reports/changes/amounts/",
|
||||||
|
|
|
@ -17,21 +17,21 @@ class ChildReportList(PermissionRequiredMixin, DetailView):
|
||||||
template_name = "reports/report_list.html"
|
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
|
model = models.Child
|
||||||
permission_required = ("core.view_child",)
|
permission_required = ("core.view_child",)
|
||||||
template_name = "reports/breastpump_amounts.html"
|
template_name = "reports/pumping_amounts.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
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"]
|
child = context["object"]
|
||||||
changes = models.Breastpump.objects.filter(child=child)
|
changes = models.Pumping.objects.filter(child=child)
|
||||||
if changes and changes.count() > 0:
|
if changes and changes.count() > 0:
|
||||||
context["html"], context["js"] = graphs.breastpump_amounts(changes)
|
context["html"], context["js"] = graphs.pumping_amounts(changes)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
<glyph glyph-name="temperature" unicode="" 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="temperature" unicode="" 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="" 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="" 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>
|
</font>
|
||||||
</defs>
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -86,7 +86,7 @@
|
||||||
|
|
||||||
<glyph glyph-name="temperature" unicode="" 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="temperature" unicode="" 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="" 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="" 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>
|
</font>
|
||||||
</defs>
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue