This commit is contained in:
Trey t
2023-06-14 21:23:50 -05:00
parent 3da41c3352
commit f0a4b2f717
904 changed files with 85 additions and 31 deletions

Binary file not shown.

View File

@@ -7,4 +7,4 @@ from .models import *
class ExerciseAdmin(ImportExportModelAdmin):
search_fields = ['name', 'description', 'movement_patterns']
list_display = ("name", "description", "synonyms",)
readonly_fields = ('return_video_url',)
readonly_fields = ('video_url', 'audio_url',)

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-14 13:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exercise', '0002_alter_exercise_options'),
]
operations = [
migrations.AddField(
model_name='exercise',
name='duration',
field=models.IntegerField(blank=True, max_length=4, null=True),
),
]

View File

@@ -0,0 +1,17 @@
# Generated by Django 4.2.2 on 2023-06-14 13:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exercise', '0003_exercise_duration'),
]
operations = [
migrations.RemoveField(
model_name='exercise',
name='duration',
),
]

View File

@@ -20,12 +20,15 @@ class Exercise(models.Model):
equipment_required = models.CharField(null=True, blank=True, max_length=255)
muscle_groups = models.CharField(null=True, blank=True, max_length=255)
synonyms = models.CharField(null=True, blank=True, max_length=255)
class Meta:
ordering = ('name',)
def __str__(self):
return self.name + ":" + self.description
def return_video_url(self):
return str(settings.STATIC_ROOT) + "/" + self.name.replace(" ", "%20") + ".mp4"
def video_url(self):
return str(settings.MEDIA_URL) + "exercise_videos/" + self.name.replace(" ", "_") + ".mp4"
def audio_url(self):
return str(settings.MEDIA_URL) + "exercise_audio/" + self.name.replace(" ", "_") + ".m4a"

View File

@@ -7,7 +7,8 @@ from muscle.serializers import ExerciseMuscleSerializer
class ExerciseSerializer(serializers.ModelSerializer):
muscles = serializers.SerializerMethodField()
equipment = serializers.SerializerMethodField()
return_video_url = serializers.ReadOnlyField()
audio_url = serializers.ReadOnlyField()
video_url = serializers.ReadOnlyField()
class Meta:
model = Exercise

View File

@@ -4,5 +4,5 @@ from . import views
urlpatterns = [
# path('sync_equipment/', views.sync_equipment, name='sync_equipment'),
path('sync_muscle_groups/', views.sync_equipment, name='sync_equipment'),
# path('sync_muscle_groups/', views.sync_muscle_groups, name='sync_equipment'),
]

View File

@@ -24,7 +24,7 @@ def sync_equipment(request):
return Response(status=status.HTTP_200_OK)
@api_view(['GET'])
def sync_equipment(request):
def sync_muscle_groups(request):
all_exercise = Exercise.objects.all()
for exercise in all_exercise:
all_muscle_groups = exercise.muscle_groups.split(',')

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 504 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B

View File

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

View File

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

View File

Before

Width:  |  Height:  |  Size: 560 B

After

Width:  |  Height:  |  Size: 560 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

View File

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 436 B

View File

Before

Width:  |  Height:  |  Size: 560 B

After

Width:  |  Height:  |  Size: 560 B

View File

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 458 B

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

Some files were not shown because too many files have changed in this diff Show More