Install django-model-utils and use it for automatic timestamp fields on entries
This commit is contained in:
parent
4b4ab324cc
commit
1e56d5a09a
5 changed files with 63 additions and 9 deletions
41
entries/migrations/0006_auto_20171102_1200.py
Normal file
41
entries/migrations/0006_auto_20171102_1200.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.6 on 2017-11-02 01:00
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
import django.utils.timezone
|
||||
import model_utils.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('entries', '0005_auto_20171027_1557'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='entry',
|
||||
options={'ordering': ['-created'], 'verbose_name_plural': 'entries'},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='entry',
|
||||
old_name='published',
|
||||
new_name='created',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='entry',
|
||||
old_name='updated',
|
||||
new_name='modified',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='entry',
|
||||
name='created',
|
||||
field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='entry',
|
||||
name='modified',
|
||||
field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue