0👍
✅
Following this Answer I did this.
from django.db.models import Func, F, Value
.
.
.
attend, created = models.AttendanceModel.objects.get_or_create(user=fingerprint.user, date=attendance_date)
attend.time = Func(F('time'), Value(attendance.timestamp.time()), function='array_append')
attend.save()
1👍
attend.time = attend.time.append(attendance.timestamp.time())
Here the return value of list.append(...)
is being assigned to attend.time
, which is None
, thus the attend.time
is not getting updated.
Try this instead,
attend, created = models.AttendanceModel.objects.get_or_create(
user=fingerprint.user, date=attendance_date
)
attend.time.append(attendance.timestamp.time())
attend.save()
👤JPG
- [Answered ]-Django admin: view hangs on field_sets block
- [Answered ]-Django : retrieve data from models
- [Answered ]-Can't select related category in Django
- [Answered ]-Authenticate works but login does not. It's stuck on pending
- [Answered ]-Can't connect django to exist MS SQL Server using mssql-django
Source:stackexchange.com