|
|
@ -115,9 +115,31 @@ class HadisCategory(LowercaseSlugMixin, MPTTModel): |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def share_link(self): |
|
|
def share_link(self): |
|
|
if self.slug: |
|
|
|
|
|
return f"{settings.DOVODI_DOMAIN}/arguments/category/{self.slug}" |
|
|
|
|
|
|
|
|
if not self.slug: |
|
|
return None |
|
|
return None |
|
|
|
|
|
has_children = getattr(self, "annotated_has_children", None) |
|
|
|
|
|
if has_children is None: |
|
|
|
|
|
if self.pk: |
|
|
|
|
|
has_children = self.children.exists() |
|
|
|
|
|
else: |
|
|
|
|
|
has_children = False |
|
|
|
|
|
|
|
|
|
|
|
if has_children: |
|
|
|
|
|
sect_type = "shia" |
|
|
|
|
|
if self.sect_id: |
|
|
|
|
|
try: |
|
|
|
|
|
if hasattr(self, "sect") and self.sect: |
|
|
|
|
|
sect_type = getattr(self.sect, "sect_type", "shia") |
|
|
|
|
|
else: |
|
|
|
|
|
from .category import HadisSect |
|
|
|
|
|
sect = HadisSect.objects.filter(id=self.sect_id).first() |
|
|
|
|
|
if sect: |
|
|
|
|
|
sect_type = sect.sect_type |
|
|
|
|
|
except Exception: |
|
|
|
|
|
sect_type = "shia" |
|
|
|
|
|
return f"{settings.DOVODI_DOMAIN}/arguments/categories/{sect_type}/{self.slug}" |
|
|
|
|
|
|
|
|
|
|
|
return f"{settings.DOVODI_DOMAIN}/arguments/category/{self.slug}" |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def xmind_share_link(self): |
|
|
def xmind_share_link(self): |
|
|
|