def _get_absolute_url(): try: site = current_site() if site == self.section.site: return reverse_app( ( f"{site.id}-blog-{self.namespace.name}-{self.category}", f"{site.id}-blog-{self.namespace.name}", f"{site.id}-blog-{self.category}", f"{site.id}-blog", ), "article-detail", kwargs={"slug": self.slug}, languages=[self.language_code], ) with set_current_site(self.section.site): site = self.section.site return ("//" + self.section.site.host + reverse_app( [ f'{site.id}-blog-{self.namespace.name}-{self.category or ""}', f"{site.id}-blog-{self.namespace.name}", f'{site.id}-blog-{self.category or ""}', f"{site.id}-blog", ], "article-detail", urlconf=apps_urlconf(), kwargs={"slug": self.slug}, languages=[self.language_code], )) except NoReverseMatch: return "#"
def get_absolute_url(self): try: site = current_site() return reverse_app([f"{site.id}-people"], "person-detail", kwargs={"pk": self.pk}) except NoReverseMatch: return ""
def get_absolute_url(self, *args, **kwargs): if self.redirect_to_url or self.redirect_to_page: return self.redirect_to_url or self.redirect_to_page.get_absolute_url( ) site = current_site() if site == self.site: return super().get_absolute_url(*args, **kwargs) return "//" + self.site.host + super().get_absolute_url()
def get_absolute_url(self): site = current_site() try: return ( reverse_app( [f"{site.id}-glossary"], "glossary", languages=[self.language_code], ) + f"#{self.slug}" ) except: return "#"
def get_absolute_url(self): site = current_site() try: return reverse_app( (str(site.id) + "-categories",), "category-detail", languages=[self.language_code], kwargs={"slug": self.slug}, ) except NoReverseMatch: return "#"
def get_absolute_url(self): site = current_site() if self.section.site == site: return reverse_app( (f"{self.section.site_id}-people", ), "team-detail", kwargs={"pk": self.pk}, ) with set_current_site(self.section.site): return ("//" + self.section.site.host + reverse_app( [f"{self.section.site.id}-people"], "team-detail", urlconf=apps_urlconf(), kwargs={"pk": self.pk}, ))
def get_absolute_url(self): try: site = current_site() if not self.section or site == self.section.site: return reverse_app([f"{site.pk}-events"], "location-detail", kwargs={"slug": self.slug}) with set_current_site(self.section.site): return ("//" + self.section.site.host + reverse_app( [f"{self.section.site.id}-events"], "location-detail", urlconf=apps_urlconf(), kwargs={"slug": self.slug}, )) except NoReverseMatch: return "#"
def get_event_list(plugin): if plugin.events.exists(): return plugin.events.all() from juso.events.models import Event events = Event.objects.filter(language_code=plugin.language_code, end_date__gte=timezone.now()) if plugin.category: events = events.filter(category=plugin.category) if plugin.sections.exists(): events = events.filter(section__in=plugin.sections.all()) else: events = events.filter(section__site=current_site()) return events[:plugin.count]
def _get_absolute_url(): try: site = current_site() if site == self.section.site: return reverse_app( [ f"{site.id}-events-{self.category}", f"{site.id}-events", ], "event-detail", urlconf=apps_urlconf(), kwargs={ "slug": self.slug, "day": self.start_date.day, "month": self.start_date.month, "year": self.start_date.year, }, languages=[self.language_code], ) with set_current_site(self.section.site): return ("//" + self.section.site.host + reverse_app( [ f"{self.section.site.id}-events-{self.category}", f"{self.section.site.id}-events", ], "event-detail", urlconf=apps_urlconf(), kwargs={ "slug": self.slug, "day": self.start_date.day, "month": self.start_date.month, "year": self.start_date.year, }, languages=[self.language_code], )) except NoReverseMatch: return "#"
def active(self, *, site=None): return self.filter(is_active=True, site=site or current_site())
def get_absolute_url(self, *args, **kwargs): site = current_site() if site == self.site: return super().get_absolute_url(*args, **kwargs) return '//' + self.site.host + super().get_absolute_url()