Skip to content

Commit

Permalink
add parameter to fix the number of vids to show on home page
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitloup committed Mar 22, 2022
1 parent 5eda7d6 commit 3cf0d16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pod/custom/settings_local.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ HOMEPAGE_SHOWS_PASSWORDED = False
"""
HOMEPAGE_SHOWS_RESTRICTED = False

"""
# Nombre de vidéos à afficher sur la page d'accueil
# par défaut, le nombre est fixé à 12
"""
HOMEPAGE_NB_VIDEOS = 12

"""
# Les mots clés saisis lors de l'ajout de vidéo sont convertis
# automatiquement en minuscule
Expand Down
3 changes: 2 additions & 1 deletion pod/video/templatetags/video_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

HOMEPAGE_SHOWS_PASSWORDED = getattr(django_settings, "HOMEPAGE_SHOWS_PASSWORDED", True)
HOMEPAGE_SHOWS_RESTRICTED = getattr(django_settings, "HOMEPAGE_SHOWS_RESTRICTED", True)
HOMEPAGE_NB_VIDEOS = getattr(django_settings, "HOMEPAGE_NB_VIDEOS", 12)


@register.simple_tag
Expand Down Expand Up @@ -67,7 +68,7 @@ def get_last_videos(context):
if vid.encoded:
recent_vids.append(vid)
count = count + 1
if count >= 12:
if count >= HOMEPAGE_NB_VIDEOS:
break

return recent_vids

0 comments on commit 3cf0d16

Please sign in to comment.