BO 1.15 faq, training plans
This commit is contained in:
parent
88bdf7703f
commit
cbe7ab97ef
@ -8,4 +8,5 @@ from .tutorial import TutorialAdmin
|
|||||||
from .evaluation import EvaluationAdmin, EvaluationAttributeAdmin
|
from .evaluation import EvaluationAdmin, EvaluationAttributeAdmin
|
||||||
from .exercise_plan import ExercisePlanAdmin
|
from .exercise_plan import ExercisePlanAdmin
|
||||||
from .description import DescriptionAdmin
|
from .description import DescriptionAdmin
|
||||||
|
from .training_plan import TrainingPlanAdmin, TrainingPlanDetailAdmin
|
||||||
|
from .faq import FaqAdmin
|
||||||
|
22
aitrainer_backoffice/aitrainer_backoffice/admin/faq.py
Normal file
22
aitrainer_backoffice/aitrainer_backoffice/admin/faq.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from ..models.faq import Faq, FaqTranslation
|
||||||
|
|
||||||
|
|
||||||
|
class FaqDescriptionInline(admin.TabularInline):
|
||||||
|
model = FaqTranslation
|
||||||
|
fields = ('language_code', 'name_translation', 'description_translation')
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
|
class FaqAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name',)
|
||||||
|
fields = ('name','description')
|
||||||
|
|
||||||
|
inlines = [
|
||||||
|
FaqDescriptionInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Faq, FaqAdmin)
|
||||||
|
admin.autodiscover()
|
@ -0,0 +1,84 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.utils.html import format_html
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from ..models.training_plan import TrainingPlan, TrainingPlanDetail
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name',)
|
||||||
|
fields = ('name',)
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDetailAdmin(admin.ModelAdmin):
|
||||||
|
list_display = (
|
||||||
|
'training_plan', 'exercise_type', 'sort', 'set', 'repeats', 'max', 'weight', 'calc',
|
||||||
|
'resting_time', 'parallel', 'day')
|
||||||
|
list_filter = ('training_plan__name', 'exercise_type__name')
|
||||||
|
list_editable = (
|
||||||
|
'exercise_type', 'sort', 'set', 'repeats', 'weight', 'resting_time', 'parallel', 'day')
|
||||||
|
ordering = ('sort',)
|
||||||
|
|
||||||
|
def repeat_max(self, obj):
|
||||||
|
if obj.repeat_max:
|
||||||
|
obj.repeats = -1
|
||||||
|
else:
|
||||||
|
obj.repeats = 0
|
||||||
|
|
||||||
|
def get_training_plan_info_info(self):
|
||||||
|
first_row = _("Special cases: Weight = -1 IF the Weight should be calculated.")
|
||||||
|
second_row = _("Repeats = -1 IF the repeats should be maximized")
|
||||||
|
return first_row + second_row
|
||||||
|
|
||||||
|
def changelist_view(self, request, extra_context=None):
|
||||||
|
response = super(TrainingPlanDetailAdmin, self).changelist_view(request, extra_context)
|
||||||
|
extra_context = {
|
||||||
|
'extra_hint': self.get_training_plan_info_info()
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
response.context_data.update(extra_context)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
return response
|
||||||
|
|
||||||
|
def copy_attributes(self, request, queryset):
|
||||||
|
for objectAttr in reversed(queryset):
|
||||||
|
objectAttr.pk = None
|
||||||
|
objectAttr.sort = objectAttr.sort + 1
|
||||||
|
objectAttr.save()
|
||||||
|
copy_attributes.short_description = _("Clone the selected Training Plan Detail")
|
||||||
|
|
||||||
|
def select_max_repeat(self, request, queryset):
|
||||||
|
for obj in queryset:
|
||||||
|
obj.repeats = -1
|
||||||
|
obj.save()
|
||||||
|
select_max_repeat.short_description = _("Select the exercises with MAX repeats")
|
||||||
|
|
||||||
|
def select_weight_calc(self, request, queryset):
|
||||||
|
for obj in queryset:
|
||||||
|
obj.weight = -1
|
||||||
|
obj.save()
|
||||||
|
select_weight_calc.short_description = _("Select the exercises CALCULATED weight")
|
||||||
|
|
||||||
|
def max(self, obj):
|
||||||
|
color_code = "000000"
|
||||||
|
if obj.repeats and obj.repeats == -1:
|
||||||
|
color_code = 'C20000'
|
||||||
|
|
||||||
|
html = '<span style="color: #{};font-size:32px">{}</span>'.format(color_code, "*")
|
||||||
|
return format_html(html)
|
||||||
|
|
||||||
|
def calc(self, obj):
|
||||||
|
color_code = "000000"
|
||||||
|
if obj.weight == -1:
|
||||||
|
color_code = 'C20000'
|
||||||
|
|
||||||
|
html = '<span style="color: #{};font-size:32px">{}</span>'.format(color_code, "*")
|
||||||
|
return format_html(html)
|
||||||
|
|
||||||
|
actions = [copy_attributes, select_max_repeat, select_weight_calc]
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(TrainingPlan, TrainingPlanAdmin)
|
||||||
|
admin.site.register(TrainingPlanDetail, TrainingPlanDetailAdmin)
|
||||||
|
admin.autodiscover()
|
Binary file not shown.
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-04-24 11:26+0200\n"
|
"POT-Creation-Date: 2021-05-10 16:50+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -24,6 +24,68 @@ msgstr ""
|
|||||||
msgid "Image Preview"
|
msgid "Image Preview"
|
||||||
msgstr "Kép előnézet"
|
msgstr "Kép előnézet"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\admin\training_plan.py:29
|
||||||
|
msgid "Special cases: Weight = -1 IF the Weight should be calculated."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\admin\training_plan.py:30
|
||||||
|
msgid "Repeats = -1 IF the repeats should be maximized"
|
||||||
|
msgstr "Ismétlés: -1, HA MAX ismétlés"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\admin\training_plan.py:49
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "Training Plan Detail"
|
||||||
|
msgid "Clone the selected Training Plan Detail"
|
||||||
|
msgstr "Edzésprogram részlet"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\admin\training_plan.py:55
|
||||||
|
msgid "Select the exercises with MAX repeats"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\admin\training_plan.py:61
|
||||||
|
msgid "Select the exercises CALCULATED weight"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\description.py:11
|
||||||
|
#: .\aitrainer_backoffice\models\evaluation.py:40
|
||||||
|
#: .\aitrainer_backoffice\models\faq.py:11
|
||||||
|
#: .\aitrainer_backoffice\models\training_plan.py:10
|
||||||
|
#: .\aitrainer_backoffice\models\tutorial.py:11
|
||||||
|
msgid "name"
|
||||||
|
msgstr "Név"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\description.py:19
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Leírás"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\description.py:20
|
||||||
|
msgid "Descriptions"
|
||||||
|
msgstr "Leírás"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\description.py:34
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_device.py:53
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_plan.py:32
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:38
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_type.py:72
|
||||||
|
#: .\aitrainer_backoffice\models\exercisetree.py:33
|
||||||
|
#: .\aitrainer_backoffice\models\faq.py:32
|
||||||
|
#: .\aitrainer_backoffice\models\property.py:29
|
||||||
|
#: .\aitrainer_backoffice\models\tutorial.py:45
|
||||||
|
msgid "Translation"
|
||||||
|
msgstr "Fordítás"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\description.py:35
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_device.py:54
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_plan.py:33
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:39
|
||||||
|
#: .\aitrainer_backoffice\models\exercise_type.py:73
|
||||||
|
#: .\aitrainer_backoffice\models\exercisetree.py:34
|
||||||
|
#: .\aitrainer_backoffice\models\faq.py:33
|
||||||
|
#: .\aitrainer_backoffice\models\property.py:30
|
||||||
|
#: .\aitrainer_backoffice\models\tutorial.py:46
|
||||||
|
msgid "Translations"
|
||||||
|
msgstr "Fordítások"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\evaluation.py:10
|
#: .\aitrainer_backoffice\models\evaluation.py:10
|
||||||
msgid "exercise_type"
|
msgid "exercise_type"
|
||||||
msgstr "Aktuális gyakorlat"
|
msgstr "Aktuális gyakorlat"
|
||||||
@ -44,11 +106,6 @@ msgstr "Kiértékelés Csoport"
|
|||||||
msgid "evaluation_foreign"
|
msgid "evaluation_foreign"
|
||||||
msgstr "Kiértékelés Főcsoport"
|
msgstr "Kiértékelés Főcsoport"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\evaluation.py:40
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:11
|
|
||||||
msgid "name"
|
|
||||||
msgstr "Név"
|
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\evaluation.py:41
|
#: .\aitrainer_backoffice\models\evaluation.py:41
|
||||||
msgid "sex"
|
msgid "sex"
|
||||||
msgstr "Nem"
|
msgstr "Nem"
|
||||||
@ -86,12 +143,12 @@ msgid "Evaluation Tables"
|
|||||||
msgstr "Kiértékelés táblák"
|
msgstr "Kiértékelés táblák"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_device.py:18
|
#: .\aitrainer_backoffice\models\exercise_device.py:18
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:88
|
#: .\aitrainer_backoffice\models\exercise_type.py:86
|
||||||
msgid "Exercise Device"
|
msgid "Exercise Device"
|
||||||
msgstr "Edzés eszköz"
|
msgstr "Edzés eszköz"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_device.py:19
|
#: .\aitrainer_backoffice\models\exercise_device.py:19
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:89
|
#: .\aitrainer_backoffice\models\exercise_type.py:87
|
||||||
msgid "Exercise Devices"
|
msgid "Exercise Devices"
|
||||||
msgstr "Edzés eszközök"
|
msgstr "Edzés eszközök"
|
||||||
|
|
||||||
@ -103,26 +160,6 @@ msgstr "Eszköz alternatíva"
|
|||||||
msgid "Device Alternatives"
|
msgid "Device Alternatives"
|
||||||
msgstr "Eszköz alternatívák"
|
msgstr "Eszköz alternatívák"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_device.py:53
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan.py:32
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:40
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:74
|
|
||||||
#: .\aitrainer_backoffice\models\exercisetree.py:33
|
|
||||||
#: .\aitrainer_backoffice\models\property.py:29
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:45
|
|
||||||
msgid "Translation"
|
|
||||||
msgstr "Fordítás"
|
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_device.py:54
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan.py:33
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:41
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:75
|
|
||||||
#: .\aitrainer_backoffice\models\exercisetree.py:34
|
|
||||||
#: .\aitrainer_backoffice\models\property.py:30
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:46
|
|
||||||
msgid "Translations"
|
|
||||||
msgstr "Fordítások"
|
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan.py:16
|
#: .\aitrainer_backoffice\models\exercise_plan.py:16
|
||||||
msgid "Exercise Plan"
|
msgid "Exercise Plan"
|
||||||
msgstr "Edzésterv"
|
msgstr "Edzésterv"
|
||||||
@ -139,51 +176,51 @@ msgstr "Edzésterv gyakorlat"
|
|||||||
msgid "Exercise Plan Details"
|
msgid "Exercise Plan Details"
|
||||||
msgstr "Edzésterv gyakorlatok"
|
msgstr "Edzésterv gyakorlatok"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:23
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:22
|
||||||
msgid "Exercise Plan Template"
|
msgid "Exercise Plan Template"
|
||||||
msgstr "Edzésterv sablon"
|
msgstr "Edzésterv sablon"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:24
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:23
|
||||||
msgid "Exercise Plan Templates"
|
msgid "Exercise Plan Templates"
|
||||||
msgstr "Edzésterv sablonok"
|
msgstr "Edzésterv sablonok"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:59
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:57
|
||||||
msgid "Exercise Plan Template Detail"
|
msgid "Exercise Plan Template Detail"
|
||||||
msgstr "Edzésterv sablon gyakorlat"
|
msgstr "Edzésterv sablon gyakorlat"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_plan_template.py:60
|
#: .\aitrainer_backoffice\models\exercise_plan_template.py:58
|
||||||
msgid "Exercise Plan Template Details"
|
msgid "Exercise Plan Template Details"
|
||||||
msgstr "Edzésterv sablon gyakorlatok"
|
msgstr "Edzésterv sablon gyakorlatok"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:35
|
#: .\aitrainer_backoffice\models\exercise_type.py:34
|
||||||
msgid "Exercise"
|
msgid "Exercise"
|
||||||
msgstr "Gyakorlat"
|
msgstr "Gyakorlat"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:36
|
#: .\aitrainer_backoffice\models\exercise_type.py:35
|
||||||
msgid "Exercises"
|
msgid "Exercises"
|
||||||
msgstr "Gyakorlatok"
|
msgstr "Gyakorlatok"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:57
|
#: .\aitrainer_backoffice\models\exercise_type.py:56
|
||||||
msgid "Image"
|
msgid "Image"
|
||||||
msgstr "Kép"
|
msgstr "Kép"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:58
|
#: .\aitrainer_backoffice\models\exercise_type.py:57
|
||||||
msgid "Images"
|
msgid "Images"
|
||||||
msgstr "Képek"
|
msgstr "Képek"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:101
|
#: .\aitrainer_backoffice\models\exercise_type.py:99
|
||||||
msgid "Exercise Alternative"
|
msgid "Exercise Alternative"
|
||||||
msgstr "Gyakorlat alternatíva"
|
msgstr "Gyakorlat alternatíva"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:102
|
#: .\aitrainer_backoffice\models\exercise_type.py:100
|
||||||
msgid "Exercise Alternatives"
|
msgid "Exercise Alternatives"
|
||||||
msgstr "Gyakorlat alternatívák"
|
msgstr "Gyakorlat alternatívák"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:113
|
#: .\aitrainer_backoffice\models\exercise_type.py:111
|
||||||
msgid "Exercise Parent"
|
msgid "Exercise Parent"
|
||||||
msgstr "Gyakorlat szülő"
|
msgstr "Gyakorlat szülő"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\exercise_type.py:114
|
#: .\aitrainer_backoffice\models\exercise_type.py:112
|
||||||
msgid "Exercise Parents"
|
msgid "Exercise Parents"
|
||||||
msgstr "Gyakorlat szülők"
|
msgstr "Gyakorlat szülők"
|
||||||
|
|
||||||
@ -204,6 +241,14 @@ msgstr "Szülő menüpont"
|
|||||||
msgid "Menu Tree Representation"
|
msgid "Menu Tree Representation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\faq.py:16
|
||||||
|
msgid "FAQ"
|
||||||
|
msgstr "GYÍK"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\faq.py:17
|
||||||
|
msgid "FAQs"
|
||||||
|
msgstr "GYÍK"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\product.py:24
|
#: .\aitrainer_backoffice\models\product.py:24
|
||||||
msgid "Product"
|
msgid "Product"
|
||||||
msgstr "Termék"
|
msgstr "Termék"
|
||||||
@ -228,6 +273,22 @@ msgstr "Ügyfél tulajdonság"
|
|||||||
msgid "Customer Properties"
|
msgid "Customer Properties"
|
||||||
msgstr "Ügyfél tulajdonságok"
|
msgstr "Ügyfél tulajdonságok"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\training_plan.py:14
|
||||||
|
msgid "Training Plan"
|
||||||
|
msgstr "Edzésprogram Csoport"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\training_plan.py:15
|
||||||
|
msgid "Training Plans"
|
||||||
|
msgstr "Edzésprogram Csoportok"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\training_plan.py:35
|
||||||
|
msgid "Training Plan Detail"
|
||||||
|
msgstr "Edzésprogram részlet"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\models\training_plan.py:36
|
||||||
|
msgid "Training Plan Details"
|
||||||
|
msgstr "Edzésprogram részletek"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:15
|
#: .\aitrainer_backoffice\models\tutorial.py:15
|
||||||
msgid "Tutorial"
|
msgid "Tutorial"
|
||||||
msgstr "Tutorial"
|
msgstr "Tutorial"
|
||||||
@ -236,14 +297,34 @@ msgstr "Tutorial"
|
|||||||
msgid "Tutorials"
|
msgid "Tutorials"
|
||||||
msgstr "Tutoriálok"
|
msgstr "Tutoriálok"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:32
|
#: .\aitrainer_backoffice\models\tutorial.py:33
|
||||||
msgid "Tutorial Step"
|
msgid "Tutorial Step"
|
||||||
msgstr "Tutorial lépés"
|
msgstr "Tutorial lépés"
|
||||||
|
|
||||||
#: .\aitrainer_backoffice\models\tutorial.py:33
|
#: .\aitrainer_backoffice\models\tutorial.py:34
|
||||||
msgid "Tutorial Steps"
|
msgid "Tutorial Steps"
|
||||||
msgstr "Tutorial lépések"
|
msgstr "Tutorial lépések"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\templates\admin\change_list.html:31
|
||||||
|
msgid "Home"
|
||||||
|
msgstr "Főoldal"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\templates\admin\change_list.html:51
|
||||||
|
msgid "Please correct the error below."
|
||||||
|
msgstr "Kérlek javítsd az alábbi hibát"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\templates\admin\change_list.html:51
|
||||||
|
msgid "Please correct the errors below."
|
||||||
|
msgstr "Kérlek javítsd az alábbi hibákat"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\templates\admin\change_list.html:79
|
||||||
|
msgid "Filter"
|
||||||
|
msgstr "Szűrő"
|
||||||
|
|
||||||
|
#: .\aitrainer_backoffice\templates\admin\change_list.html:81
|
||||||
|
msgid "Clear all filters"
|
||||||
|
msgstr "Szűrő törlése"
|
||||||
|
|
||||||
#~ msgid "exercise_device_parent"
|
#~ msgid "exercise_device_parent"
|
||||||
#~ msgstr "Gyakorlat Eszköz szülő"
|
#~ msgstr "Gyakorlat Eszköz szülő"
|
||||||
|
|
||||||
|
@ -11,3 +11,5 @@ from .property import Property, PropertyTranslation
|
|||||||
from .tutorial import Tutorial, TutorialSteps, TutorialTranslation
|
from .tutorial import Tutorial, TutorialSteps, TutorialTranslation
|
||||||
from .evaluation import Evaluation, EvaluationAttribute
|
from .evaluation import Evaluation, EvaluationAttribute
|
||||||
from .description import Description, DescriptionTranslation
|
from .description import Description, DescriptionTranslation
|
||||||
|
from .training_plan import TrainingPlan, TrainingPlanDetail
|
||||||
|
from .faq import Faq, FaqTranslation
|
||||||
|
@ -10,7 +10,7 @@ class Description(models.Model):
|
|||||||
name = models.CharField(max_length=50, help_text='Unique description name',
|
name = models.CharField(max_length=50, help_text='Unique description name',
|
||||||
verbose_name=_("name"))
|
verbose_name=_("name"))
|
||||||
description = RichTextField()
|
description = RichTextField()
|
||||||
version = models.IntegerField(max_length=3, blank=True)
|
version = models.IntegerField(blank=True)
|
||||||
valid_from = models.DateTimeField(blank=True)
|
valid_from = models.DateTimeField(blank=True)
|
||||||
valid_to = models.DateTimeField(blank=True)
|
valid_to = models.DateTimeField(blank=True)
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ class ExerciseType(models.Model):
|
|||||||
|
|
||||||
exercise_type_id = models.AutoField(primary_key=True)
|
exercise_type_id = models.AutoField(primary_key=True)
|
||||||
name = models.CharField(max_length=100, help_text='The name should be in English here')
|
name = models.CharField(max_length=100, help_text='The name should be in English here')
|
||||||
#description = models.TextField(max_length=1000, blank=True, null=True, help_text='The description should be in English here')
|
description = RichTextField(blank=True, null=True, help_text='The description should be in English here')
|
||||||
description = RichTextField()
|
|
||||||
unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.REPEAT, max_length=50, blank=True, null=True)
|
unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.REPEAT, max_length=50, blank=True, null=True)
|
||||||
unit_quantity = models.BooleanField(default=0, blank=True, null=True)
|
unit_quantity = models.BooleanField(default=0, blank=True, null=True)
|
||||||
unit_quantity_unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.KG, max_length=50, blank=True,
|
unit_quantity_unit = models.CharField(choices=UnitTypes.choices, default=UnitTypes.KG, max_length=50, blank=True,
|
||||||
@ -66,7 +65,6 @@ class ExerciseTypeTranslation(models.Model):
|
|||||||
exercise_type = models.ForeignKey(ExerciseType, on_delete=models.CASCADE)
|
exercise_type = models.ForeignKey(ExerciseType, on_delete=models.CASCADE)
|
||||||
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
#description = models.TextField(max_length=1000, blank=True, null=True)
|
|
||||||
description = RichTextField(blank=True, null=True)
|
description = RichTextField(blank=True, null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
33
aitrainer_backoffice/aitrainer_backoffice/models/faq.py
Normal file
33
aitrainer_backoffice/aitrainer_backoffice/models/faq.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from ckeditor.fields import RichTextField
|
||||||
|
|
||||||
|
from .enums import LanguageTypes
|
||||||
|
|
||||||
|
|
||||||
|
class Faq(models.Model):
|
||||||
|
faq_id = models.AutoField(primary_key=True)
|
||||||
|
name = models.CharField(max_length=50, help_text='Unique description name',
|
||||||
|
verbose_name=_("name"))
|
||||||
|
description = RichTextField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'faq'
|
||||||
|
verbose_name = _("FAQ")
|
||||||
|
verbose_name_plural = _("FAQs")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class FaqTranslation(models.Model):
|
||||||
|
faq_translation_id = models.AutoField(primary_key=True)
|
||||||
|
faq = models.ForeignKey(Faq, on_delete=models.CASCADE)
|
||||||
|
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
||||||
|
name_translation = RichTextField()
|
||||||
|
description_translation = RichTextField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'faq_translation'
|
||||||
|
verbose_name = _("Translation")
|
||||||
|
verbose_name_plural = _("Translations")
|
@ -0,0 +1,37 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from ..models import ExerciseType
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlan(models.Model):
|
||||||
|
training_plan_id = models.AutoField(primary_key=True)
|
||||||
|
name = models.CharField(max_length=100, help_text='The name of the training plan',
|
||||||
|
verbose_name=_("name"))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'training_plan'
|
||||||
|
verbose_name = _("Training Plan")
|
||||||
|
verbose_name_plural = _("Training Plans")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class TrainingPlanDetail(models.Model):
|
||||||
|
training_plan_detail_id = models.AutoField(primary_key=True)
|
||||||
|
training_plan = models.ForeignKey(TrainingPlan, on_delete=models.CASCADE)
|
||||||
|
exercise_type = models.ForeignKey(ExerciseType, on_delete=models.CASCADE)
|
||||||
|
sort = models.IntegerField()
|
||||||
|
set = models.IntegerField()
|
||||||
|
repeats = models.IntegerField(blank=True)
|
||||||
|
weight = models.IntegerField(blank=True)
|
||||||
|
resting_time = models.IntegerField(blank=True)
|
||||||
|
parallel = models.BooleanField(blank=True)
|
||||||
|
day = models.CharField(max_length=50, blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
db_table = 'training_plan_detail'
|
||||||
|
verbose_name = _("Training Plan Detail")
|
||||||
|
verbose_name_plural = _("Training Plan Details")
|
||||||
|
|
@ -64,7 +64,7 @@ ROOT_URLCONF = 'aitrainer_backoffice.urls'
|
|||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [],
|
"DIRS": [os.path.join(BASE_DIR, "templates"), ],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
@ -90,6 +90,14 @@ DATABASES = {
|
|||||||
'PASSWORD': 'andio2009',
|
'PASSWORD': 'andio2009',
|
||||||
'HOST': '127.0.0.1',
|
'HOST': '127.0.0.1',
|
||||||
'PORT': 3306
|
'PORT': 3306
|
||||||
|
},
|
||||||
|
'live': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'aitrainer2',
|
||||||
|
'USER': 'aitrainer',
|
||||||
|
'PASSWORD': 'andio2009',
|
||||||
|
'HOST': '127.0.0.1',
|
||||||
|
'PORT': 3306
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
{% extends "admin/base_site.html" %}
|
||||||
|
{% load i18n admin_urls static admin_list %}
|
||||||
|
|
||||||
|
{% block extrastyle %}
|
||||||
|
{{ block.super }}
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/changelists.css' %}">
|
||||||
|
{% if cl.formset %}
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/forms.css' %}">
|
||||||
|
{% endif %}
|
||||||
|
{% if cl.formset or action_form %}
|
||||||
|
<script src="{% url 'admin:jsi18n' %}"></script>
|
||||||
|
{% endif %}
|
||||||
|
{{ media.css }}
|
||||||
|
{% if not actions_on_top and not actions_on_bottom %}
|
||||||
|
<style>
|
||||||
|
#changelist table thead th:first-child {width: inherit}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ media.js }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}
|
||||||
|
|
||||||
|
{% if not is_popup %}
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<div class="breadcrumbs">
|
||||||
|
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
|
||||||
|
› <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a>
|
||||||
|
› {{ cl.opts.verbose_name_plural|capfirst }}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block coltype %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div id="content-main">
|
||||||
|
{% block object-tools %}
|
||||||
|
<ul class="object-tools">
|
||||||
|
{% block object-tools-items %}
|
||||||
|
{% change_list_object_tools %}
|
||||||
|
{% endblock %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
||||||
|
{% if cl.formset and cl.formset.errors %}
|
||||||
|
<p class="errornote">
|
||||||
|
{% if cl.formset.total_error_count == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %}
|
||||||
|
</p>
|
||||||
|
{{ cl.formset.non_form_errors }}
|
||||||
|
{% endif %}
|
||||||
|
<p>{{ extra_hint|default:"" }}</p>
|
||||||
|
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
|
||||||
|
<div class="changelist-form-container">
|
||||||
|
{% block search %}{% search_form cl %}{% endblock %}
|
||||||
|
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
|
||||||
|
{% if cl.formset %}
|
||||||
|
<div>{{ cl.formset.management_form }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block result_list %}
|
||||||
|
{% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
|
||||||
|
{% result_list cl %}
|
||||||
|
{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block pagination %}{% pagination cl %}{% endblock %}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% block filters %}
|
||||||
|
{% if cl.has_filters %}
|
||||||
|
<div id="changelist-filter">
|
||||||
|
<h2>{% translate 'Filter' %}</h2>
|
||||||
|
{% if cl.has_active_filters %}<h3 id="changelist-filter-clear">
|
||||||
|
<a href="{{ cl.clear_all_filters_qs }}">✖ {% translate "Clear all filters" %}</a>
|
||||||
|
</h3>{% endif %}
|
||||||
|
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
5
aitrainer_backoffice/static/training_plan.js
Normal file
5
aitrainer_backoffice/static/training_plan.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
(function($){ // your code
|
||||||
|
$( "#weight_calc" ).click(function() {
|
||||||
|
alert( "Handler for .click() called." );
|
||||||
|
});
|
||||||
|
})(django.jQuery);
|
Loading…
Reference in New Issue
Block a user