mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-20 17:50:16 -04:00
feat(authentication): add last modified, redo admin interface
This commit is contained in:
parent
0ebfb59bb7
commit
899017c01a
|
@ -5,6 +5,40 @@ from .models import User
|
||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
class UserAdmin(admin.ModelAdmin):
|
||||||
search_fields = ["username", "first_name", "last_name"]
|
search_fields = ["username", "first_name", "last_name"]
|
||||||
|
list_display = ["username", "last_name", "first_name", "last_modified"]
|
||||||
|
list_filter = ["is_senior", "accepted_terms", "is_student"]
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
{
|
||||||
|
"fields": (
|
||||||
|
"username",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"email",
|
||||||
|
"password",
|
||||||
|
"accepted_terms",
|
||||||
|
"is_staff",
|
||||||
|
"is_superuser",
|
||||||
|
"is_senior",
|
||||||
|
"graduation_year",
|
||||||
|
"is_student",
|
||||||
|
"last_modified",
|
||||||
|
"last_login",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Senior information",
|
||||||
|
{"fields": ("biography", "attending_decision", "publish_data")},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
readonly_fields = (
|
||||||
|
"last_modified",
|
||||||
|
"last_login",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2 on 2021-04-23 17:52
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("authentication", "0008_alter_user_biography"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="user",
|
||||||
|
name="last_modified",
|
||||||
|
field=models.DateTimeField(auto_now=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -31,5 +31,7 @@ class User(AbstractUser):
|
||||||
help_text="Can't see your college? Make sure you've added a decision with an admit status.",
|
help_text="Can't see your college? Make sure you've added a decision with an admit status.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
last_modified = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.first_name} {self.last_name}"
|
return f"{self.first_name} {self.last_name}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user