diff --git a/rowers/admin.py b/rowers/admin.py index fad8795b..7ef887fb 100644 --- a/rowers/admin.py +++ b/rowers/admin.py @@ -24,7 +24,7 @@ class RowerInline(admin.StackedInline): ('Billing Details', {'fields':('street_address','city','postal_code','country','paymentprocessor','customer_id')}), ('Rower Plan', - {'fields':('paidplan','rowerplan','paymenttype','planexpires','teamplanexpires','protrialexpires','plantrialexpires',)}), + {'fields':('paidplan','rowerplan','paymenttype','planexpires','teamplanexpires','protrialexpires','plantrialexpires','clubsize','offercoaching')}), ('Rower Settings', {'fields': ('gdproptin','gdproptindate','weightcategory','sex','adaptiveclass','birthdate','getemailnotifications', @@ -60,7 +60,7 @@ class RowerInline(admin.StackedInline): #class UserAdmin(UserAdmin): class UserAdmin(admin.ModelAdmin): inlines = (RowerInline,) - list_display = ('username','email','first_name','last_name','rowerplan') + list_display = ('username','email','first_name','last_name','rowerplan','clubsize') fieldsets = ( ('Personal info', @@ -75,6 +75,9 @@ class UserAdmin(admin.ModelAdmin): def rowerplan(self, obj): return obj.rower.rowerplan + def clubsize(self, obj): + return obj.rower.clubsize + class WorkoutAdmin(admin.ModelAdmin): list_display = ('date','user','name','workouttype','boattype') diff --git a/rowers/teams.py b/rowers/teams.py index 72efb3d4..8980e8a8 100644 --- a/rowers/teams.py +++ b/rowers/teams.py @@ -119,7 +119,7 @@ def add_coach(coach,rower): coach.mycoachgroup = coachgroup coach.save() - if get_coach_club_size(coach)<=coach.clubsize: + if get_coach_club_size(coach)=coach.clubsize: + return(0,'You have reached the maximum number of athletes') else: return (0,'You are not a coach') diff --git a/rowers/tests/testdata/testdata.csv.gz b/rowers/tests/testdata/testdata.csv.gz index ab9bd8a4..0a15e5a0 100644 Binary files a/rowers/tests/testdata/testdata.csv.gz and b/rowers/tests/testdata/testdata.csv.gz differ diff --git a/rowers/views/teamviews.py b/rowers/views/teamviews.py index 224a2ef7..0fff0eb4 100644 --- a/rowers/views/teamviews.py +++ b/rowers/views/teamviews.py @@ -189,7 +189,9 @@ def rower_teams_view(request,message='',successmessage=''): coachrequests = CoachRequest.objects.filter(coach=r) invitedathletes = [rekwest.user for rekwest in mycoachoffers] - invitedcoaches = [rekwest.coach for rekwest in mycoachrequests] + invitedcoaches = [rekwest.coach for rekwest in mycoachrequests ] + invitedcoaches += [rekwest.coach for rekwest in coachoffers] + invitingathletes = [rekwest.user for rekwest in coachrequests] coaches = teams.rower_get_coaches(r) @@ -200,6 +202,7 @@ def rower_teams_view(request,message='',successmessage=''): ] potentialcoaches = list(set(potentialcoaches+offercoaches)) potentialcoaches = [c for c in potentialcoaches if c.rower not in invitedcoaches+coaches] + potentialcoaches = [c for c in potentialcoaches if teams.get_coach_club_size(c.rower)