Skip to content

Commit

Permalink
Merge pull request #513 from openstax/profile-model-admin
Browse files Browse the repository at this point in the history
Add admin for account profile
  • Loading branch information
edwoodward authored Oct 26, 2017
2 parents 0e24d2c + 516393c commit 6d2ac7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
from django.contrib import admin
from .models import Profile

admin.site.register(Profile)

class ProfileAdmin(admin.ModelAdmin):
readonly_fields = ('uuid', )
list_display = ('user', 'uuid', 'faculty_status',)
search_fields = ('uuid', 'user__username', 'user__email', 'user__last_name')
list_filter = ('faculty_status', )

admin.site.register(Profile, ProfileAdmin)
3 changes: 3 additions & 0 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class Profile(models.Model):
uuid = models.UUIDField(blank=True, null=True)
faculty_status = models.TextField(blank=True, null=True)

def __str__(self):
return self.user.email


@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
Expand Down

0 comments on commit 6d2ac7b

Please sign in to comment.