Skip to content

Commit

Permalink
Use storage for the Team model (#90)
Browse files Browse the repository at this point in the history
* Using storage for Team model too

* Team avatar can be blank
  • Loading branch information
hugsy authored Jul 4, 2023
1 parent e5710ca commit f11ff1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 8 additions & 2 deletions ctfhub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
EXCALIDRAW_ROOM_ID_REGEX,
EXCALIDRAW_ROOM_KEY_REGEX,
EXCALIDRAW_URL,
HEDGEDOC_URL,
IMAGE_URL,
JITSI_URL,
USERS_FILE_PATH,
Expand Down Expand Up @@ -86,7 +85,14 @@ class Team(TimeStampedModel):
youtube_url = models.URLField(blank=True)
blog_url = models.URLField(blank=True)
api_key = models.CharField(max_length=128, default=get_random_string_128)
avatar = models.ImageField(blank=True, upload_to=USERS_FILE_PATH)
avatar = models.ImageField(
blank=True,
upload_to=USERS_FILE_PATH,
storage=get_named_storage("MEDIA"),
validators=[
challenge_file_max_size_validator,
],
)
ctftime_id = models.IntegerField(default=0, blank=True, null=True)

#
Expand Down
10 changes: 1 addition & 9 deletions ctfhub_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,10 @@ def get_boolean(key: str) -> bool:
},
]


# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/

LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
USE_TZ = False

STATIC_URL = "/static/"
STATICFILES_DIRS = [
Expand Down

0 comments on commit f11ff1d

Please sign in to comment.