django-user-sessions
django-user-sessions copied to clipboard
Added created field to Session model
In response to Issue #66 I added the field myself and created this PR. Shouldn't negatively impact anything, and I made the migration set the created
to be equal to the value of last_activity
rather than being ahead of it for backward compatibility.
Fixed the data migration reversing, but the TravisCI failures are going to take some extra work on my part. Best I can tell they are related to https://code.djangoproject.com/ticket/17654 and the way the db.py
save
function updates existing records. That said, in production I'm not running into any errors.
Maybe we should use force_insert
in the tests when creating the sessions? Does that resolve the issue? See also our db backend.
That might help, I'm going to do some testing over the weekend.
@Bourke, I did some testing at the time and have been using my own fork for a while, but figure it's time to get this PR finalized. The code still works fine, just the tests fail due to auto_add_now
an re-using of the pk
. Any ideas to get around this by changing the tests?
Alternatively, could use a datetimefield
and override save to set the value manually, but that's not ideal.