Вопрос уже здесь обсуждался
Вот эту изучил
Советовали пользоваться
django-modeladmin-reorder
Выполнил все по инструкции, но не работает так как нужно. Поправьте, может где то ошибки в коде
models.py
from django.db import models
from mametamorphose import settings
....
class Video(models.Model):
PAGE_CHOOSE = (
('1', 'Login'),
('2', 'Step1'),
('3', 'Step2'),
('4', 'Step3'),
)
url = models.URLField(max_length=250)
page = models.IntegerField(choices=PAGE_CHOOSE)
class Quiz(models.Model):
question = models.TextField()
def __str__(self):
return self.question
class Meta:
verbose_name = 'Quiz'
verbose_name_plural = 'Quizzes'
class Plan(models.Model):
title = models.CharField(max_length=255)
cost = models.FloatField(max_length=25)
description = models.TextField()
def __str__(self):
return self.title
admin.py
from django.contrib import admin
from .models import Video, Quiz, Plan, Blog
from copy import deepcopy
from mezzanine.blog.admin import BlogPostAdmin
from mezzanine.blog.models import BlogPost
from django.db import models
class PlanAdmin(admin.ModelAdmin):
list_display = ["title", "cost", "description"]
list_display_links = ('title',)
class Meta:
model = Plan
admin.site.register(Video)
admin.site.register(Quiz)
admin.site.register(Plan, PlanAdmin)
settings.py
INSTALLED_APPS = (
.....
"admin_reorder",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.redirects",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.sitemaps",
"django.contrib.staticfiles",
.....
ADMIN_REORDER = (
# First group
{'app': 'MyApp', 'label': 'Group1',
'models': ('MyApp.Quiz',
'MyApp.Plan',)
},
# Second group: same app, but different label
{'app': 'MyApp', 'label': 'Group2',
'models': ('MyApp.Video',)
},)