-
Notifications
You must be signed in to change notification settings - Fork 1
Add a flag to events to hide them from the events overview #2108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
aTrueYety
wants to merge
7
commits into
master
from
erikhoff00/web-129-add-a-flag-to-events-to-hide-them-from-the-events-overview
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c6aad32
Add is_hidden flag to event object
17da13e
Fix bug to make hidden flag load state into form on edit
c99a103
Add translations for new is hidden field
1324c5e
Add event view filtering to hide hidden events
51d6cf2
Bump font size of s and xs text sizes
b48ec88
Style hidden flag
6e3f8d5
Change label and help text for hidden checkbox
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated by Django 5.2.11 on 2026-03-10 20:48 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('samfundet', '0005_medlemsinfo'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='is_hidden', | ||
| field=models.BooleanField(default=False), | ||
| ), | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import datetime | ||
| from typing import TYPE_CHECKING | ||
| from operator import or_ | ||
| from functools import reduce | ||
| from collections.abc import Callable | ||
|
|
||
| if TYPE_CHECKING: | ||
| from rest_framework.request import Request | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. burde ikke trenge denne ifen siden type hinting eval blir forsinka av |
||
| from django.conf import settings | ||
| from django.http import QueryDict | ||
| from django.contrib import admin | ||
|
|
@@ -20,6 +24,18 @@ | |
| from .models.event import Event | ||
| from .models.recruitment import Recruitment, OccupiedTimeslot, RecruitmentInterviewAvailability | ||
|
|
||
|
|
||
| def visible_events_for_user(request: Request) -> QuerySet[Event]: | ||
| """Returns the base Event queryset for a request, filtering out hidden events unless the user has edit permission.""" | ||
| from root.custom_classes.permission_classes import has_required_permissions | ||
|
|
||
| user = request.user | ||
| can_edit = user.is_authenticated and (user.has_perm('samfundet.change_event') or has_required_permissions(request, ['samfundet.change_event'])) | ||
| if can_edit: | ||
| return Event.objects.all() | ||
| return Event.objects.filter(is_hidden=False) | ||
|
|
||
|
|
||
| SEARCH_FIELDS = ( | ||
| 'title_nb__icontains', | ||
| 'title_en__icontains', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,3 +87,7 @@ | |
| padding-bottom: 3.75em; | ||
| gap: 0.5em; | ||
| } | ||
|
|
||
| .checkbox { | ||
| margin-top: 0.5em; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hvorfor kan ikke
statusfeltet i Event brukes til dette formålet? Der kan man sette status til "privat".Status sjekkes forsåvidt ikke i homepage, fikses i denne PRen.
Det mangler også et felt i frontend admin til å sette
status