Skip to content

Commit

Permalink
feature/aahq-44-django-groups-and-custom-user-tie-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
aahnik committed Jan 1, 2024
1 parent e5f6a3d commit 097fdc7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class TempleWebUserAdmin(UserAdmin):
form = TempleWebAdminUserChangeForm
add_form = TempleWebUserCreationForm

list_display = ["email", "is_superuser"]
list_filter = ["is_superuser"]
list_display = ["full_name", "email", "date_joined", "is_staff"]
list_filter = ["is_staff"]

fieldsets = [
(
Expand All @@ -38,21 +38,23 @@ class TempleWebUserAdmin(UserAdmin):
"fields": [
"email",
"password",
"is_superuser",
"first_name",
"last_name",
"is_staff",
]
},
)
),
(
"Permissions",
{"fields": ["is_staff", "groups", "user_permissions"]},
),
]

add_fieldsets = [
(
None,
{
"classes": ["wide"],
"fields": ["email", "password1", "password2", "is_superuser"],
"fields": ["email", "password1", "password2", "is_staff"],
},
)
]
Expand Down
2 changes: 1 addition & 1 deletion src/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TempleWebUserCreationForm(forms.ModelForm):

class Meta:
model = TempleWebUser
fields = ["email"]
fields = ["email", "is_staff", "first_name", "last_name"]

def clean_password2(self):
# Check that the two password entries match
Expand Down
3 changes: 3 additions & 0 deletions src/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class TempleWebUser(AbstractUser):
def __str__(self):
return self.email

def full_name(self):
return self.get_full_name()


class UserProfile(models.Model):
user = models.OneToOneField(TempleWebUser, on_delete=models.CASCADE)
Expand Down

0 comments on commit 097fdc7

Please sign in to comment.