mirror of https://github.com/snachodog/mybuddy.git
parent
7a2eab0173
commit
3f0694dc9d
File diff suppressed because one or more lines are too long
|
@ -153,7 +153,13 @@ class FeedingForm(CoreModelForm):
|
||||||
class NoteForm(CoreModelForm):
|
class NoteForm(CoreModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Note
|
model = models.Note
|
||||||
fields = ['child', 'note']
|
fields = ['child', 'note', 'time']
|
||||||
|
widgets = {
|
||||||
|
'time': forms.DateTimeInput(attrs={
|
||||||
|
'readonly': 'readonly',
|
||||||
|
'data-target': '#datetimepicker_time',
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class SleepForm(CoreModelForm):
|
class SleepForm(CoreModelForm):
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.1 on 2020-08-13 02:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0011_auto_20200214_1939'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='note',
|
||||||
|
name='time',
|
||||||
|
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Time'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -262,7 +262,11 @@ class Note(models.Model):
|
||||||
verbose_name=_('Child')
|
verbose_name=_('Child')
|
||||||
)
|
)
|
||||||
note = models.TextField(verbose_name=_('Note'))
|
note = models.TextField(verbose_name=_('Note'))
|
||||||
time = models.DateTimeField(auto_now=True, verbose_name=_('Time'))
|
time = models.DateTimeField(
|
||||||
|
default=timezone.now,
|
||||||
|
blank=False,
|
||||||
|
verbose_name=_('Time')
|
||||||
|
)
|
||||||
|
|
||||||
objects = models.Manager()
|
objects = models.Manager()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'babybuddy/page.html' %}
|
{% extends 'babybuddy/page.html' %}
|
||||||
{% load i18n %}
|
{% load datetimepicker i18n %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if request.resolver_match.url_name == 'note-update' %}
|
{% if request.resolver_match.url_name == 'note-update' %}
|
||||||
|
@ -28,3 +28,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'babybuddy/form.html' %}
|
{% include 'babybuddy/form.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascript %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
BabyBuddy.DatetimePicker.init($('#datetimepicker_time'), {
|
||||||
|
format: '{% datetimepicker_format %}'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue