added meta_title to display in cms
This commit is contained in:
parent
bf0838102c
commit
7bb3e06903
|
|
@ -1,6 +1,3 @@
|
|||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList
|
||||
|
|
@ -52,7 +49,9 @@ class Module(StrictHierarchyPage):
|
|||
parent_page_types = ['books.Topic']
|
||||
subpage_types = ['books.Chapter']
|
||||
|
||||
#todo: isn't this a duplicate definition?
|
||||
|
||||
|
||||
# todo: isn't this a duplicate definition?
|
||||
def get_child_ids(self):
|
||||
return self.get_children().values_list('id', flat=True)
|
||||
|
||||
|
|
@ -93,6 +92,8 @@ class Module(StrictHierarchyPage):
|
|||
for objective_group in objective_groups:
|
||||
objective_group.sync_visibility(school_class_template, school_class_to_sync)
|
||||
|
||||
def get_admin_display_title(self):
|
||||
return f"{self.meta_title} - {self.title}"
|
||||
|
||||
|
||||
class RecentModule(models.Model):
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ class Topic(StrictHierarchyPage):
|
|||
FieldPanel('description'),
|
||||
]
|
||||
|
||||
|
||||
edit_handler = TabbedInterface([
|
||||
ObjectList(content_panels, heading='Content'),
|
||||
get_default_settings()
|
||||
|
|
@ -40,3 +39,17 @@ class Topic(StrictHierarchyPage):
|
|||
|
||||
parent_page_types = ['books.Book']
|
||||
subpage_types = ['books.Module']
|
||||
|
||||
# TODO: THis orders the queryset for the modules but not the visual ordering in cms
|
||||
# def get_children(self):
|
||||
# qs = super().get_children()
|
||||
# qs = qs.order_by('module__meta_title')
|
||||
# print('')
|
||||
# for p in qs:
|
||||
# if hasattr(p, 'module'):
|
||||
# print(f"{p.module.meta_title} {p.title}")
|
||||
# return qs
|
||||
|
||||
def get_admin_display_title(self):
|
||||
return f"" \
|
||||
f"{self.get_verbose_name()}- {self.title}"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
from django.core.management import BaseCommand
|
||||
|
||||
from core.factories import UserFactory
|
||||
from users.services import create_users, create_student
|
||||
from .data.user_data import user_data
|
||||
|
||||
from users.models import User
|
||||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
UserFactory(
|
||||
username='test',
|
||||
is_staff=True,
|
||||
is_superuser=True,
|
||||
first_name='Nicol',
|
||||
last_name='Bolas',
|
||||
onboarding_visited=True
|
||||
)
|
||||
|
||||
create_users(user_data)
|
||||
|
||||
# create student without class
|
||||
create_student(
|
||||
username='hansli',
|
||||
first_name='Hansli',
|
||||
last_name='Alleini'
|
||||
)
|
||||
|
||||
users = User.objects.all()
|
||||
|
||||
for usr in users:
|
||||
print(usr.email)
|
||||
usr.set_password('test')
|
||||
usr.save()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue