Repository: ephios-dev/ephios

Issue:
Improve static file management
Currently all external JS and CSS files are loaded from CDNs. We should discuss whether we want to serve those files locally and how we want to manage the versions of these files (e.g. with yarn)


Discussion:
@felixrindt I'm not sure if we really want to use yarn. This would mean that the dependencies are not part of the code but need to be included before running an instance, so everyone needs to install yarn beforehand and I'm not sure how to install something a package installed by pip. Pretix includes all dependencies in the repo (as we already do with fontawesome). Or we could just stick with the CDNs, as this will always be an application with internet connection available. 
I think I would go with including all dependencies into the repo as there are only a few (jquery, bootstrap, datatables, select2, fontawesome), updating is not much harder as with a CDN and it may be a good thing to minimize external requests in terms of privacy. CDN would probably be a bit faster and easier to update. Package manager is not an option IMO

Resolving patch:
diff --git a/event_management/migrations/0001_initial.py b/event_management/migrations/0001_initial.py
--- a/event_management/migrations/0001_initial.py
+++ b/event_management/migrations/0001_initial.py
@@ -3,7 +3,6 @@
 from django.conf import settings
 from django.db import migrations, models
 import django.db.models.deletion
-import jsonfallback.fields
 
 
 class Migration(migrations.Migration):
@@ -66,7 +65,7 @@ class Migration(migrations.Migration):
                 ("start_time", models.DateTimeField()),
                 ("end_time", models.DateTimeField()),
                 ("signup_method_slug", models.SlugField()),
-                ("signup_configuration", jsonfallback.fields.FallbackJSONField()),
+                ("signup_configuration", models.JSONField()),
                 (
                     "event",
                     models.ForeignKey(
diff --git a/event_management/models.py b/event_management/models.py
--- a/event_management/models.py
+++ b/event_management/models.py
@@ -10,11 +10,11 @@
     SlugField,
     TextField,
     Manager,
+    JSONField,
 )
 from django.utils.functional import cached_property
 from polymorphic.models import PolymorphicModel
 from django.utils import formats
-from jsonfallback.fields import FallbackJSONField
 from django.utils.translation import gettext_lazy as _
 
 from jep import settings
@@ -97,7 +97,7 @@ class Shift(Model):
     start_time = DateTimeField(_("start time"))
     end_time = DateTimeField(_("end time"))
     signup_method_slug = SlugField(_("signup method"))
-    signup_configuration = FallbackJSONField()
+    signup_configuration = JSONField(default=dict)
 
     class Meta:
         verbose_name = _("shift")
diff --git a/jep/settings.py b/jep/settings.py
--- a/jep/settings.py
+++ b/jep/settings.py
@@ -148,6 +148,13 @@
 GUARDIAN_MONKEY_PATCH = False
 
 
+# django-select2
+# Prevent django-select from loading the select2 resources as we want to serve them locally
+SELECT2_JS = ""
+SELECT2_CSS = ""
+SELECT2_I18N_PATH = ""
+
+
 # django-debug-toolbar
 if DEBUG:
     INSTALLED_APPS.append("debug_toolbar")


Test patch: