最终效果 类似 淘宝 京东商城首页分类
模型层 model.py
class Category(BaseTime):
"""
商品类别
"""
objects = None
name = models.CharField(max_length=18, verbose_name='类别名称')
parent = models.ForeignKey('self', related_name='subs', null=True, blank=True, on_delete=models.CASCADE,
verbose_name='父类别')
class Meta:
# db_table = 'water_goods_category'
verbose_name = '商品类别test'
verbose_name_plural = verbose_name
def __str__(self):
return self.name
class ChannelGroup(BaseTime):
"""商品频道组"""
objects = None
name = models.CharField(max_length=20, verbose_name='频道组名')
class Meta:
# db_table = 'water_channel_group'
verbose_name = '商品频道组'
verbose_name_plural = verbose_name
def __str__(self):
return self.name
class Channel(BaseTime