You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class testLesson(models.Model):
title = models.CharField(max_length=200)
def __str__(self):
return self.title
class testCell(models.Model):
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
lesson = models.ForeignKey(testLesson, on_delete=models.CASCADE)
content = models.TextField()
class Meta:
ordering = ['my_order']
def __str__(self):
return self.content[:50]
Admin.py:
from .models import testCell, testLesson
from adminsortable2.admin import SortableTabularInline, SortableAdminBase
class testCellInline(SortableTabularInline):
model = testCell
extra = 1
@admin.register(testLesson)
class testLessonAdmin(SortableAdminBase, admin.ModelAdmin):
inlines = [testCellInline]
View in admin portal:
The text was updated successfully, but these errors were encountered:
Django 4.1
Minimal replication:
Models.py:
Admin.py:
View in admin portal:
The text was updated successfully, but these errors were encountered: