Skip to content

Commit f11ff1d

Browse files
authored
Use storage for the Team model (#90)
* Using storage for Team model too * Team avatar can be blank
1 parent e5710ca commit f11ff1d

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

ctfhub/models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
EXCALIDRAW_ROOM_ID_REGEX,
5252
EXCALIDRAW_ROOM_KEY_REGEX,
5353
EXCALIDRAW_URL,
54-
HEDGEDOC_URL,
5554
IMAGE_URL,
5655
JITSI_URL,
5756
USERS_FILE_PATH,
@@ -86,7 +85,14 @@ class Team(TimeStampedModel):
8685
youtube_url = models.URLField(blank=True)
8786
blog_url = models.URLField(blank=True)
8887
api_key = models.CharField(max_length=128, default=get_random_string_128)
89-
avatar = models.ImageField(blank=True, upload_to=USERS_FILE_PATH)
88+
avatar = models.ImageField(
89+
blank=True,
90+
upload_to=USERS_FILE_PATH,
91+
storage=get_named_storage("MEDIA"),
92+
validators=[
93+
challenge_file_max_size_validator,
94+
],
95+
)
9096
ctftime_id = models.IntegerField(default=0, blank=True, null=True)
9197

9298
#

ctfhub_project/settings.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,10 @@ def get_boolean(key: str) -> bool:
131131
},
132132
]
133133

134-
135-
# Internationalization
136-
# https://docs.djangoproject.com/en/3.1/topics/i18n/
137-
138134
LANGUAGE_CODE = "en-us"
139135
TIME_ZONE = "UTC"
140136
USE_I18N = True
141-
USE_TZ = True
142-
143-
144-
# Static files (CSS, JavaScript, Images)
145-
# https://docs.djangoproject.com/en/3.1/howto/static-files/
137+
USE_TZ = False
146138

147139
STATIC_URL = "/static/"
148140
STATICFILES_DIRS = [

0 commit comments

Comments
 (0)