I am new to DjangoCMS. So please bear with me if the question is too trivial.
I have made an app hook for adding staff for a website with model.py
from django.db import models
from filer.fields.image import FilerImageField
from djangocms_text_ckeditor.fields import HTMLField
from django.urls import reverse
from cms.models.fields import PlaceholderField
# Create your models here.
class Designations(models.Model):
class Meta:
app_label = 'voxstaff'
verbose_name_plural = 'designations'
desingation = models.CharField(
blank=False,
help_text="Please provide a label for the Designation",
unique=True,
max_length=100
)
def __str__(self):
return self.desingation
class Staffs(models.Model):
class Meta:
app_label = 'voxstaff'
full_name = models.CharField(
blank=False,
unique=True,
help_text="Please enter the full name of the staff",
max_length=100
)
slug = models.SlugField(
blank=False,
default='',
help_text='Provide a unique slug for this staff member',
max_length=100,
)
desingation = models.ForeignKey(
Designations,
on_delete=models.SET_NULL,
blank=True,
null=True
)
photo = FilerImageField(
blank=True,
null=True,
on_delete=models.SET_NULL,
)
staff_intro = HTMLField(blank=True)
bio = PlaceholderField("staff_bio")
is_featured = models.BooleanField()
def get_absolute_url(self):
return reverse("voxstaff:staffs_detail", kwargs={"slug": self.slug})
def __str__(self):
return self.full_name
class LinkTypes(models.Model):
link_type = models.CharField(max_length=100)
def __str__(self):
return self.link_type
class Links(models.Model):
staff = models.ForeignKey(Staffs,on_delete=models.CASCADE)
link_type = models.ForeignKey(LinkTypes,on_delete=models.SET_NULL,null=True,blank=True)
link_url = models.CharField(max_length=200)
def __str__(self):
return self.link_type.link_type
And cms_apps.py as below
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from .menu import StaffSubMenu
@apphook_pool.register
class StaffApp(CMSApp):
name = _('VOXStaff')
# urls = ['voxstaff.urls', ]
app_name = 'voxstaff'
menus = [StaffSubMenu, ]
def get_urls(self, page=None, language=None, **kwargs):
return ["voxstaff.urls"]
Now I need to Plugin that displays the staffs in the Home page. These staff should be with is_featured as Yes int the Staffs model.
How to proceed for the same. Please help, I am stuck.