BO 1.12.1 tutorials steps edit list fields

This commit is contained in:
Bossanyi Tibor 2021-04-29 15:32:42 +02:00
parent e432225761
commit 311fa6071c
2 changed files with 13 additions and 13 deletions

View File

@ -5,16 +5,17 @@ from ..models.tutorial import TutorialTranslation, Tutorial, TutorialSteps
class TranslationTutorialInline(admin.TabularInline):
model = TutorialTranslation
fields = ('language_code', 'tutorial_text', 'error_text')
fields = ('language_code', 'tutorial_text')
extra = 0
class TutorialStepsAdmin(admin.ModelAdmin):
list_display = ('tutorial_step_id', 'tutorial', 'check_text', 'step', 'parent', 'branch')
list_display = ('tutorial_step_id', 'tutorial', 'check_text', 'step', 'direction', 'parent_id', 'branch')
list_filter = ('tutorial__name',)
fields = ('tutorial', 'step', "tutorial_text", "check_text", "direction", "condition", 'get_parent_step', 'branch', "action")
list_editable = ('parent',)
readonly_fields = ('get_parent_step',)
fields = ('tutorial', 'step', "tutorial_text", "check_text", "direction", "condition", 'parent_id', 'branch'
, "action")
list_editable = ('step','direction', 'parent_id','branch')
ordering = ('tutorial_step_id',)
def copy_attributes(self, request, queryset):
for objectAttr in reversed(queryset):

View File

@ -24,12 +24,12 @@ class TutorialSteps(models.Model):
tutorial = models.ForeignKey(Tutorial, on_delete=models.CASCADE)
step = models.IntegerField(help_text="Tutorial Step")
tutorial_text = RichTextField()
direction = models.TextField(max_length=100, blank=True, null=True, help_text="Only for programmers!")
check_text = models.TextField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
condition = models.TextField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
branch = models.TextField(max_length=100, blank=True, null=True, help_text="Only for programmers!")
##parent = models.IntegerField(help_text="Tutorial Step Parent. If not defined, then the parent is step-1")
parent = models.ForeignKey('self', blank=True, null=True, related_name='parents', on_delete=models.CASCADE)
direction = models.CharField(max_length=100, blank=True, null=True, help_text="Only for programmers!")
check_text = models.CharField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
condition = models.CharField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
branch = models.CharField(max_length=50, blank=True, null=True, help_text="Only for programmers!")
parent_id = models.IntegerField(help_text="Tutorial Step Parent.")
#parent = models.ForeignKey('self', blank=True, null=True, related_name='parents', on_delete=models.CASCADE)
action = models.BooleanField(default=0, blank=True, null=True, help_text="Tap, select menu, etc")
def get_parent_step(self):
@ -48,7 +48,6 @@ class TutorialTranslation(models.Model):
tutorial_step = models.ForeignKey(TutorialSteps, on_delete=models.CASCADE)
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
tutorial_text = RichTextField()
error_text = RichTextField(blank=True, null=True)
class Meta:
db_table = 'tutorial_translation'
@ -56,4 +55,4 @@ class TutorialTranslation(models.Model):
verbose_name_plural = _("Translations")
def __str__(self):
return self.tutorial_text
return self.tutorial_text