Skip to content
Snippets Groups Projects
Verified Commit 1725a1e9 authored by magicfelix's avatar magicfelix
Browse files

Reformat

parent c1ca2d93
No related branches found
No related tags found
1 merge request!56Release 3.0b0
Pipeline #113352 passed with warnings
......@@ -28,29 +28,29 @@ class PosterGroupDynamicRoute(DynamicRoute):
dynamic_routes = []
for poster_group in poster_groups:
dynamic_routes.append(cls.get_route_data(poster_group))
dynamic_routes.append(cls.get_route_data(poster_group))
return dynamic_routes
@classmethod
def get_route_data(cls, instance):
dynamic_route = {}
dynamic_route = {}
dynamic_route["parent_route_name"] = ""
dynamic_route["parent_route_name"] = ""
dynamic_route["route_path"] = reverse("poster_show_current", args=[instance.slug])
dynamic_route["route_name"] = f"resint.posterGroup.{instance.slug}"
dynamic_route["route_path"] = reverse("poster_show_current", args=[instance.slug])
dynamic_route["route_name"] = f"resint.posterGroup.{instance.slug}"
dynamic_route["display_account_menu"] = False
dynamic_route["display_sidenav_menu"] = instance.show_in_menu
dynamic_route["menu_new_tab"] = True
dynamic_route["display_account_menu"] = False
dynamic_route["display_sidenav_menu"] = instance.show_in_menu
dynamic_route["menu_new_tab"] = True
dynamic_route["menu_title"] = instance.name
dynamic_route["menu_icon"] = "mdi-file-pdf-box"
dynamic_route["menu_title"] = instance.name
dynamic_route["menu_icon"] = "mdi-file-pdf-box"
dynamic_route["route_permission"] = "" if instance.public else "resint.view_poster_pdf_menu"
dynamic_route["route_permission"] = "" if instance.public else "resint.view_poster_pdf_menu"
return dynamic_route
return dynamic_route
class PosterGroup(ExtensibleModel):
......@@ -58,7 +58,7 @@ class PosterGroup(ExtensibleModel):
slug = models.SlugField(
verbose_name=_("Slug used in URL name"),
help_text=_("If you use 'example', the filename will be 'example.pdf'.")
help_text=_("If you use 'example', the filename will be 'example.pdf'."),
)
name = models.CharField(max_length=255, verbose_name=_("Name"))
publishing_day = models.PositiveSmallIntegerField(
......@@ -79,8 +79,8 @@ class PosterGroup(ExtensibleModel):
verbose_name = _("Poster group")
verbose_name_plural = _("Poster groups")
constraints = [
models.UniqueConstraint(fields=["site_id", "name"], name="unique_site_name"),
models.UniqueConstraint(fields=["site_id", "slug"], name="unique_site_slug"),
models.UniqueConstraint(fields=["site_id", "name"], name="unique_site_name"),
models.UniqueConstraint(fields=["site_id", "slug"], name="unique_site_slug"),
]
permissions = [
("view_poster_of_group", _("Can view all posters of this group")),
......@@ -92,7 +92,6 @@ class PosterGroup(ExtensibleModel):
def __str__(self) -> str:
return f"{self.name} ({self.publishing_day_name}, {self.publishing_time})"
@property
def publishing_day_name(self) -> str:
"""Return the full name of the publishing day (e. g. Monday)."""
......
......@@ -104,8 +104,7 @@ add_perm("resint.view_poster_pdf", view_poster_pdf_predicate)
# View poster PDF file in menu
view_poster_pdf_menu_predicate = has_person & (
has_global_perm("resint.view_postergroup")
| has_global_perm("resint.view_poster")
has_global_perm("resint.view_postergroup") | has_global_perm("resint.view_poster")
)
add_perm("resint.view_poster_pdf_menu", view_poster_pdf_menu_predicate)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment