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

from .models import (
    Rower, Workout,GraphImage,FavoriteChart,SiteAnnouncement,
    Team,TeamInvite,TeamRequest,
    WorkoutComment,
    )

# Register your models here so you can use them in the Admin module

# Rower details directly under the User 
class RowerInline(admin.StackedInline):
    model = Rower
    can_delete = False
    verbose_name_plural = 'rower'
    filter_horizontal = ('team','friends')

class UserAdmin(UserAdmin):
    inlines = (RowerInline,)

class WorkoutAdmin(admin.ModelAdmin):
    list_display = ('date','user','name','workouttype','boattype')

class FavoriteChartAdmin(admin.ModelAdmin):
    list_display = ('user','xparam','yparam1','yparam2','plottype','workouttype','reststrokes')

class SiteAnnouncementAdmin(admin.ModelAdmin):
    list_display = ('announcement','created','modified','expires','dotweet')

class TeamAdmin(admin.ModelAdmin):
    list_display = ('name','manager')

class TeamInviteAdmin(admin.ModelAdmin):
    list_display = ('issuedate','team','user','code')
    
class TeamRequestAdmin(admin.ModelAdmin):
    list_display = ('issuedate','team','user','code')

class WorkoutCommentAdmin(admin.ModelAdmin):
    list_display = ('created','user','workout')
    
admin.site.unregister(User)
admin.site.register(User,UserAdmin)
admin.site.register(Workout,WorkoutAdmin)
admin.site.register(GraphImage)
admin.site.register(Team,TeamAdmin)
admin.site.register(FavoriteChart,FavoriteChartAdmin)
admin.site.register(SiteAnnouncement,SiteAnnouncementAdmin)
admin.site.register(TeamInvite,TeamInviteAdmin)
admin.site.register(TeamRequest,TeamRequestAdmin)
admin.site.register(WorkoutComment,WorkoutCommentAdmin)
