Skip to content

Commit 570b787

Browse files
committed
Don't automatically create commitfests in dev environments
1 parent 90792d1 commit 570b787

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

pgcommitfest/commitfest/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.conf import settings
12
from django.contrib.auth.models import User
23
from django.db import models, transaction
34
from django.db.models import Q
@@ -163,7 +164,7 @@ def _refresh_relevant_commitfests(cls, for_update):
163164

164165
@classmethod
165166
def relevant_commitfests(cls, for_update=False, refresh=True):
166-
if refresh:
167+
if refresh and settings.AUTO_CREATE_COMMITFESTS:
167168
return cls._refresh_relevant_commitfests(for_update=for_update)
168169

169170
query_base = CommitFest.objects.order_by("-enddate")

pgcommitfest/local_settings_example.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@
3232
)
3333

3434
CFBOT_SECRET = "INSECURE"
35+
36+
# There are already commitfests in the default dummy database data.
37+
# Automatically creating new ones would cause the ones that are visible on the
38+
# homepage to have no data.
39+
AUTO_CREATE_COMMITFESTS = False

pgcommitfest/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@
164164
# Email address for outgoing system messages
165165
NOTIFICATION_FROM = "[email protected]"
166166

167+
AUTO_CREATE_COMMITFESTS = True
168+
167169
# Load local settings overrides
168170
try:
169171
from .local_settings import * # noqa: F403

0 commit comments

Comments
 (0)