django-user-sessions icon indicating copy to clipboard operation
django-user-sessions copied to clipboard

Added created field to Session model

Open dwasyl opened this issue 7 years ago • 4 comments

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.

dwasyl avatar Apr 18 '17 21:04 dwasyl

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.

dwasyl avatar Apr 19 '17 07:04 dwasyl

Maybe we should use force_insert in the tests when creating the sessions? Does that resolve the issue? See also our db backend.

Bouke avatar Apr 20 '17 19:04 Bouke

That might help, I'm going to do some testing over the weekend.

dwasyl avatar Apr 22 '17 16:04 dwasyl

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

dwasyl avatar Sep 10 '18 20:09 dwasyl