mirror of
				https://github.com/fspc/workstand.git
				synced 2025-11-04 00:45:35 -05:00 
			
		
		
		
	Add fields to track member creation and edit datetimes (#48)
* Add created and updated fields.
This commit is contained in:
		
							parent
							
								
									32416d6b8f
								
							
						
					
					
						commit
						3ddaed0041
					
				@ -33,6 +33,6 @@ class CustomUserAdmin(UserAdmin):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@admin.register(Member)
 | 
					@admin.register(Member)
 | 
				
			||||||
class MemberAdmin(admin.ModelAdmin):
 | 
					class MemberAdmin(admin.ModelAdmin):
 | 
				
			||||||
    list_display = ('get_full_name',)
 | 
					    list_display = ('get_full_name', 'created_at',)
 | 
				
			||||||
    ordering = ('last_name',)
 | 
					    ordering = ('last_name', )
 | 
				
			||||||
    search_fields = ('email', 'first_name', 'last_name')
 | 
					    search_fields = ('email', 'first_name', 'last_name', 'created_at')
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					# -*- coding: utf-8 -*-
 | 
				
			||||||
 | 
					# Generated by Django 1.10.4 on 2017-05-18 03:32
 | 
				
			||||||
 | 
					from __future__ import unicode_literals
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from django.db import migrations, models
 | 
				
			||||||
 | 
					import django.utils.timezone
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Migration(migrations.Migration):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dependencies = [
 | 
				
			||||||
 | 
					        ('registration', '0003_auto_20170215_0308'),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    operations = [
 | 
				
			||||||
 | 
					        migrations.AddField(
 | 
				
			||||||
 | 
					            model_name='member',
 | 
				
			||||||
 | 
					            name='created_at',
 | 
				
			||||||
 | 
					            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
 | 
				
			||||||
 | 
					            preserve_default=False,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					        migrations.AddField(
 | 
				
			||||||
 | 
					            model_name='member',
 | 
				
			||||||
 | 
					            name='modified_at',
 | 
				
			||||||
 | 
					            field=models.DateTimeField(auto_now=True),
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
@ -96,6 +96,8 @@ class Member(models.Model):
 | 
				
			|||||||
    notes = models.TextField(null=True, blank=True)
 | 
					    notes = models.TextField(null=True, blank=True)
 | 
				
			||||||
    suspended = models.BooleanField(default=False)
 | 
					    suspended = models.BooleanField(default=False)
 | 
				
			||||||
    banned = models.BooleanField(default=False)
 | 
					    banned = models.BooleanField(default=False)
 | 
				
			||||||
 | 
					    created_at = models.DateTimeField(auto_now_add=True)
 | 
				
			||||||
 | 
					    modified_at = models.DateTimeField(auto_now=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_full_name(self):
 | 
					    def get_full_name(self):
 | 
				
			||||||
        # The user is identified by their email address
 | 
					        # The user is identified by their email address
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user