Skip to content

Commit c346fb8

Browse files
committed
add created_at field
1 parent 6cf886a commit c346fb8

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

advanced_filters/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class AdvancedFilterAdmin(admin.ModelAdmin):
113113
extra = 0
114114

115115
list_display = ('title', 'created_by', )
116-
readonly_fields = ('created_by', 'model', )
116+
readonly_fields = ('created_by', 'model', 'created_at', )
117117

118118
def has_add_permission(self, obj=None):
119119
return False
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('advanced_filters', '0001_initial'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='advancedfilter',
16+
name='created_at',
17+
field=models.DateTimeField(auto_now_add=True, null=True),
18+
),
19+
]

advanced_filters/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Meta:
2121
title = models.CharField(max_length=255, null=False, blank=False)
2222
created_by = models.ForeignKey(settings.AUTH_USER_MODEL,
2323
related_name='created_advanced_filters')
24+
created_at = models.DateTimeField(auto_now_add=True, null=True)
2425
url = models.CharField(max_length=255, null=False, blank=False)
2526
users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
2627
groups = models.ManyToManyField('auth.Group', blank=True)

0 commit comments

Comments
 (0)