Project

General

Profile

0001-oauth2-use-auto_now_add-for-creation_date-fields-226.patch

Benjamin Dauvergne, 26 Mar 2018 03:37 PM

Download (2.32 KB)

View differences:

Subject: [PATCH 1/2] oauth2: use auto_now_add for creation_date fields
 (#22682)

 fargo/oauth2/migrations/0004_auto_20180326_1330.py | 25 ++++++++++++++++++++++
 fargo/oauth2/models.py                             |  4 ++--
 2 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 fargo/oauth2/migrations/0004_auto_20180326_1330.py
fargo/oauth2/migrations/0004_auto_20180326_1330.py
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.11.11 on 2018-03-26 13:30
3
from __future__ import unicode_literals
4

  
5
from django.db import migrations, models
6

  
7

  
8
class Migration(migrations.Migration):
9

  
10
    dependencies = [
11
        ('oauth2', '0003_auto_20180322_1016'),
12
    ]
13

  
14
    operations = [
15
        migrations.AlterField(
16
            model_name='oauth2authorize',
17
            name='creation_date',
18
            field=models.DateTimeField(auto_now_add=True),
19
        ),
20
        migrations.AlterField(
21
            model_name='oauth2tempfile',
22
            name='creation_date',
23
            field=models.DateTimeField(auto_now_add=True),
24
        ),
25
    ]
fargo/oauth2/models.py
68 68
    user_document = models.ForeignKey(UserDocument)
69 69
    access_token = models.CharField(max_length=255, default=generate_uuid)
70 70
    code = models.CharField(max_length=255, default=generate_uuid)
71
    creation_date = models.DateTimeField(auto_now=True)
71
    creation_date = models.DateTimeField(auto_now_add=True)
72 72

  
73 73
    def __repr__(self):
74 74
        return 'OAuth2Authorize for document %r' % self.user_document
......
79 79
    client = models.ForeignKey(OAuth2Client)
80 80
    document = models.ForeignKey(Document)
81 81
    filename = models.CharField(max_length=512)
82
    creation_date = models.DateTimeField(auto_now=True)
82
    creation_date = models.DateTimeField(auto_now_add=True)
83
-