Skip to content

Commit

Permalink
Update migrations for "created at" field
Browse files Browse the repository at this point in the history
  • Loading branch information
mjnaderi committed Feb 5, 2018
1 parent def3c7a commit e3c0941
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 1 addition & 2 deletions qsessions/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-02-03 11:04
# Generated by Django 1.11.2 on 2017-12-19 16:00
from __future__ import unicode_literals

from django.conf import settings
Expand All @@ -24,7 +24,6 @@ class Migration(migrations.Migration):
('session_data', models.TextField(verbose_name='session data')),
('expire_date', models.DateTimeField(db_index=True, verbose_name='expire date')),
('user_agent', models.CharField(blank=True, max_length=300, null=True)),
('created_at', models.DateTimeField()),
('updated_at', models.DateTimeField(auto_now=True)),
('ip', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
Expand Down
20 changes: 20 additions & 0 deletions qsessions/migrations/0002_session_created_at.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-02-05 06:55
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('qsessions', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='session',
name='created_at',
field=models.DateTimeField(null=True),
),
]
2 changes: 1 addition & 1 deletion qsessions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Session(AbstractBaseSession):
user = models.ForeignKey(getattr(settings, 'AUTH_USER_MODEL', 'auth.User'),
null=True, on_delete=models.CASCADE)
user_agent = models.CharField(null=True, blank=True, max_length=300)
created_at = models.DateTimeField()
created_at = models.DateTimeField(null=True)
updated_at = models.DateTimeField(auto_now=True)
ip = models.GenericIPAddressField(null=True, blank=True, verbose_name=_('IP'))

Expand Down

0 comments on commit e3c0941

Please sign in to comment.