You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
756 B
26 lines
756 B
from django.contrib import admin |
|
|
|
from django.template.defaultfilters import filesizeformat |
|
|
|
from .models import Study, StudyRole |
|
|
|
# Register your models here. |
|
admin.site.register(StudyRole) |
|
|
|
|
|
class role_inline(admin.TabularInline): |
|
model = StudyRole |
|
extra = 1 |
|
|
|
|
|
@admin.register(Study) |
|
class StudyAdmin(admin.ModelAdmin): |
|
inlines = (role_inline,) |
|
|
|
list_display = ('name', 'total_files', 'total_file_size', 'total_invitations', 'created_at') |
|
ordering = ('-created_at', 'name', ) |
|
search_fields = ('name', ) |
|
readonly_fields = ('upload_uuid', 'api_upload_url', 'total_files', 'total_file_size', 'total_invitations', 'created_at', 'updated_at') |
|
|
|
def total_file_size(self, obj): |
|
return filesizeformat(obj.total_file_size)
|
|
|