adding instantplan to admin
This commit is contained in:
@@ -8,7 +8,7 @@ from .models import (
|
|||||||
WorkoutComment, C2WorldClassAgePerformance, PlannedSession,
|
WorkoutComment, C2WorldClassAgePerformance, PlannedSession,
|
||||||
GeoCourse, GeoPolygon, GeoPoint, VirtualRace, VirtualRaceResult,
|
GeoCourse, GeoPolygon, GeoPoint, VirtualRace, VirtualRaceResult,
|
||||||
PaidPlan, IndoorVirtualRaceResult, ShareKey,
|
PaidPlan, IndoorVirtualRaceResult, ShareKey,
|
||||||
CourseStandard, StandardCollection,
|
CourseStandard, StandardCollection, InstantPlan,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Register your models here so you can use them in the Admin module
|
# Register your models here so you can use them in the Admin module
|
||||||
@@ -165,6 +165,8 @@ class StandardCollectionAdmin(admin.ModelAdmin):
|
|||||||
class CourseStandardAdmin(admin.ModelAdmin):
|
class CourseStandardAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'standardcollection')
|
list_display = ('name', 'standardcollection')
|
||||||
|
|
||||||
|
class InstantPlanAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name','duration','price')
|
||||||
|
|
||||||
admin.site.unregister(User)
|
admin.site.unregister(User)
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
@@ -187,3 +189,4 @@ admin.site.register(PaidPlan, PaidPlanAdmin)
|
|||||||
admin.site.register(ShareKey, ShareKeyAdmin)
|
admin.site.register(ShareKey, ShareKeyAdmin)
|
||||||
admin.site.register(CourseStandard, CourseStandardAdmin)
|
admin.site.register(CourseStandard, CourseStandardAdmin)
|
||||||
admin.site.register(StandardCollection, StandardCollectionAdmin)
|
admin.site.register(StandardCollection, StandardCollectionAdmin)
|
||||||
|
admin.site.register(InstantPlan, InstantPlanAdmin)
|
||||||
|
|||||||
@@ -1050,7 +1050,6 @@ def get_workouts_session(r, ps):
|
|||||||
|
|
||||||
return ws
|
return ws
|
||||||
|
|
||||||
|
|
||||||
def create_sessions_from_json(plansteps, rower, startdate, manager):
|
def create_sessions_from_json(plansteps, rower, startdate, manager):
|
||||||
trainingdays = plansteps['trainingDays']
|
trainingdays = plansteps['trainingDays']
|
||||||
planstartdate = startdate
|
planstartdate = startdate
|
||||||
|
|||||||
@@ -2530,11 +2530,15 @@ def rower_view_instantplan(request, id='', userid=0):
|
|||||||
|
|
||||||
trainingdays = plansteps['trainingDays']
|
trainingdays = plansteps['trainingDays']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
trainingdays2 = []
|
trainingdays2 = []
|
||||||
nextday = trainingdays.pop(0)
|
nextday = trainingdays.pop(0)
|
||||||
|
|
||||||
for i in range(plansteps['duration']):
|
for i in range(plansteps['duration']):
|
||||||
if nextday['order'] == i+1:
|
if nextday['order'] == i+1:
|
||||||
nextday['week'] = (divmod(i, 7)[0])+1
|
nextday['week'] = (divmod(i, 7)[0])+1
|
||||||
|
|
||||||
trainingdays2.append(nextday)
|
trainingdays2.append(nextday)
|
||||||
try:
|
try:
|
||||||
nextday = trainingdays.pop(0)
|
nextday = trainingdays.pop(0)
|
||||||
@@ -2549,6 +2553,7 @@ def rower_view_instantplan(request, id='', userid=0):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
targets = TrainingTarget.objects.filter(
|
targets = TrainingTarget.objects.filter(
|
||||||
rowers=r,
|
rowers=r,
|
||||||
date__gte=timezone.now(),
|
date__gte=timezone.now(),
|
||||||
|
|||||||
Reference in New Issue
Block a user