Skip to content

Commit

Permalink
Add date joined to admin panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Sargent committed Feb 24, 2024
1 parent bd3ae0e commit 67118e2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 0.1
cli:
version: 1.19.0
version: 1.20.1
plugins:
sources:
- id: trunk
ref: v1.4.2
ref: v1.4.3
uri: https://github.com/trunk-io/plugins
lint:
ignore:
Expand All @@ -16,15 +16,15 @@ lint:
- [email protected]
- [email protected]
- [email protected]
- [email protected].20
- [email protected].24
- [email protected]
- [email protected]
- [email protected]
- trufflehog@3.67.5
- trufflehog@3.68.0
- [email protected]
- [email protected]
- [email protected].1
- yamllint@1.34.0
- [email protected].2
- yamllint@1.35.1
- [email protected]
- [email protected]
- [email protected]
Expand Down
22 changes: 22 additions & 0 deletions approval_polls/admin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
import csv

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.http import HttpResponse

from approval_polls.models import Ballot, Choice, Poll


class ApprovalPollsUserAdmin(UserAdmin):
# override the default sort column
ordering = ("-date_joined",)
# if you want the date they joined or other columns displayed in the list,
# override list_display too
list_display = (
"username",
"email",
"date_joined",
"first_name",
"last_name",
"is_staff",
)


# finally replace the default UserAdmin with yours
admin.site.unregister(User)
admin.site.register(User, ApprovalPollsUserAdmin)


class ChoiceInline(admin.TabularInline):
"""
Defines the layout of 'Choice's in the
Expand Down
2 changes: 1 addition & 1 deletion approval_polls/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
APP_NAME = env("FLY_APP_NAME", str, "")
ALLOWED_HOSTS = [f"{APP_NAME}.fly.dev", "vote.electionscience.org"] # ← Updated!
if DEBUG:
ALLOWED_HOSTS.extend(["localhost", "0.0.0.0"])
ALLOWED_HOSTS.extend(["localhost", "0.0.0.0", "127.0.0.1"])

CSRF_TRUSTED_ORIGINS = ["https://vote.electionscience.org"]
CSRF_ALLOWED_ORIGINS = ["https://vote.electionscience.org"]
Expand Down

0 comments on commit 67118e2

Please sign in to comment.