prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  StaticI18N catalog not loaded on some views
  The shift edit views tries to load `/de.js` while other views like the instance settings are loading `/static/jsi18n/de/djangojs.js` correctly, despite originating from the same `<script type="text/javascript" src="{% statici18n LANGUAGE_CODE %}"></script>` in base.html
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ephios/plugins/simpleresource/models.py`
  Content:
  ```
  1 from django.db import models
  2 
  3 from ephios.core.models import Shift
  4 
  5 
  6 class ResourceCategory(models.Model):
  7     name = models.CharField(max_length=50)
  8 
  9     def __str__(self):
  10         # pylint: disable=invalid-str-returned
  11         return self.name
  12 
  13 
  14 class Resource(models.Model):
  15     title = models.CharField(max_length=100)
  16     category = models.ForeignKey(ResourceCategory, on_delete=models.CASCADE)
  17 
  18     def __str__(self):
  19         # pylint: disable=invalid-str-returned
  20         return self.title
  21 
  22 
  23 class ResourceAllocation(models.Model):
  24     shift = models.ForeignKey(Shift, on_delete=models.CASCADE)
  25     resources = models.ManyToManyField(Resource, blank=True)
  26 
  27     def __str__(self):
  28         return f"Resource allocation for {self.shift}"
  29
  ```
  
  Path: `ephios/plugins/simpleresource/forms.py`
  Content:
  ```
  1 from django.forms import BaseModelFormSet, BooleanField, ModelForm, modelformset_factory
  2 from django.forms.formsets import DELETION_FIELD_NAME
  3 from django.utils.translation import gettext as _
  4 from django_select2.forms import Select2MultipleWidget
  5 
  6 from ephios.core.forms.events import BasePluginFormMixin
  7 from ephios.plugins.simpleresource.models import ResourceAllocation, ResourceCategory
  8 
  9 
  10 class ResourceAllocationForm(BasePluginFormMixin, ModelForm):
  11     class Meta:
  12         model = ResourceAllocation
  13         fields = ["resources"]
  14         widgets = {
  15             "resources": Select2MultipleWidget,
  16         }
  17 
  18     def __init__(self, *args, shift, **kwargs):
  19         self.shift = shift
  20         try:
  21             kwargs.setdefault("instance", ResourceAllocation.objects.get(shift=shift))
  22         except ResourceAllocation.DoesNotExist:
  23             pass
  24         super().__init__(*args, **kwargs)
  25 
  26     def save(self, commit=True):
  27         if self.cleaned_data.get("resources"):
  28             self.instance.shift = self.shift
  29             super().save(commit)
  30         elif self.instance.pk:
  31             self.instance.delete()
  32 
  33     @property
  34     def heading(self):
  35         return _("Resource allocation")
  36 
  37     def is_function_active(self):
  38         return bool(self.instance.resources.exists())
  39 
  40 
  41 class BaseResourceCategoryFormset(BaseModelFormSet):
  42     def add_fields(self, form, index):
  43         super().add_fields(form, index)
  44         initial_form_count = self.initial_form_count()
  45         if self.can_delete and (self.can_delete_extra or index < initial_form_count):
  46             category: ResourceCategory = form.instance
  47             form.fields[DELETION_FIELD_NAME] = BooleanField(
  48                 label=_("Delete"),
  49                 required=False,
  50                 disabled=category.pk and category.resource_set.exists(),
  51             )
  52 
  53 
  54 ResourceCategoryFormset = modelformset_factory(
  55     ResourceCategory,
  56     formset=BaseResourceCategoryFormset,
  57     can_delete=True,
  58     extra=0,
  59     fields=["name"],
  60 )
  61
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ephios/plugins/simpleresource/forms.py b/ephios/plugins/simpleresource/forms.py
  --- a/ephios/plugins/simpleresource/forms.py
  +++ b/ephios/plugins/simpleresource/forms.py
  @@ -1,3 +1,4 @@
  +from crispy_forms.helper import FormHelper
   from django.forms import BaseModelFormSet, BooleanField, ModelForm, modelformset_factory
   from django.forms.formsets import DELETION_FIELD_NAME
   from django.utils.translation import gettext as _
  @@ -17,6 +18,8 @@
   
       def __init__(self, *args, shift, **kwargs):
           self.shift = shift
  +        self.helper = FormHelper()
  +        self.helper.include_media = False
           try:
               kwargs.setdefault("instance", ResourceAllocation.objects.get(shift=shift))
           except ResourceAllocation.DoesNotExist:
  diff --git a/ephios/plugins/simpleresource/models.py b/ephios/plugins/simpleresource/models.py
  --- a/ephios/plugins/simpleresource/models.py
  +++ b/ephios/plugins/simpleresource/models.py
  @@ -1,10 +1,11 @@
   from django.db import models
  +from django.utils.translation import gettext_lazy as _
   
   from ephios.core.models import Shift
   
   
   class ResourceCategory(models.Model):
  -    name = models.CharField(max_length=50)
  +    name = models.CharField(max_length=50, verbose_name=_("Name"))
   
       def __str__(self):
           # pylint: disable=invalid-str-returned
  @@ -12,8 +13,10 @@
   
   
   class Resource(models.Model):
  -    title = models.CharField(max_length=100)
  -    category = models.ForeignKey(ResourceCategory, on_delete=models.CASCADE)
  +    title = models.CharField(max_length=100, verbose_name=_("Title"))
  +    category = models.ForeignKey(
  +        ResourceCategory, on_delete=models.CASCADE, verbose_name=_("Category")
  +    )
   
       def __str__(self):
           # pylint: disable=invalid-str-returned
  @@ -22,7 +25,7 @@
   
   class ResourceAllocation(models.Model):
       shift = models.ForeignKey(Shift, on_delete=models.CASCADE)
  -    resources = models.ManyToManyField(Resource, blank=True)
  +    resources = models.ManyToManyField(Resource, blank=True, verbose_name=_("Resources"))
   
       def __str__(self):
           return f"Resource allocation for {self.shift}"
  
verification_info: {"golden_diff": "diff --git a/ephios/plugins/simpleresource/forms.py b/ephios/plugins/simpleresource/forms.py\n--- a/ephios/plugins/simpleresource/forms.py\n+++ b/ephios/plugins/simpleresource/forms.py\n@@ -1,3 +1,4 @@\n+from crispy_forms.helper import FormHelper\n from django.forms import BaseModelFormSet, BooleanField, ModelForm, modelformset_factory\n from django.forms.formsets import DELETION_FIELD_NAME\n from django.utils.translation import gettext as _\n@@ -17,6 +18,8 @@\n \n     def __init__(self, *args, shift, **kwargs):\n         self.shift = shift\n+        self.helper = FormHelper()\n+        self.helper.include_media = False\n         try:\n             kwargs.setdefault(\"instance\", ResourceAllocation.objects.get(shift=shift))\n         except ResourceAllocation.DoesNotExist:\ndiff --git a/ephios/plugins/simpleresource/models.py b/ephios/plugins/simpleresource/models.py\n--- a/ephios/plugins/simpleresource/models.py\n+++ b/ephios/plugins/simpleresource/models.py\n@@ -1,10 +1,11 @@\n from django.db import models\n+from django.utils.translation import gettext_lazy as _\n \n from ephios.core.models import Shift\n \n \n class ResourceCategory(models.Model):\n-    name = models.CharField(max_length=50)\n+    name = models.CharField(max_length=50, verbose_name=_(\"Name\"))\n \n     def __str__(self):\n         # pylint: disable=invalid-str-returned\n@@ -12,8 +13,10 @@\n \n \n class Resource(models.Model):\n-    title = models.CharField(max_length=100)\n-    category = models.ForeignKey(ResourceCategory, on_delete=models.CASCADE)\n+    title = models.CharField(max_length=100, verbose_name=_(\"Title\"))\n+    category = models.ForeignKey(\n+        ResourceCategory, on_delete=models.CASCADE, verbose_name=_(\"Category\")\n+    )\n \n     def __str__(self):\n         # pylint: disable=invalid-str-returned\n@@ -22,7 +25,7 @@\n \n class ResourceAllocation(models.Model):\n     shift = models.ForeignKey(Shift, on_delete=models.CASCADE)\n-    resources = models.ManyToManyField(Resource, blank=True)\n+    resources = models.ManyToManyField(Resource, blank=True, verbose_name=_(\"Resources\"))\n \n     def __str__(self):\n         return f\"Resource allocation for {self.shift}\"\n", "issue": "StaticI18N catalog not loaded on some views\nThe shift edit views tries to load `/de.js` while other views like the instance settings are loading `/static/jsi18n/de/djangojs.js` correctly, despite originating from the same `<script type=\"text/javascript\" src=\"{% statici18n LANGUAGE_CODE %}\"></script>` in base.html\n", "before_files": [{"content": "from django.db import models\n\nfrom ephios.core.models import Shift\n\n\nclass ResourceCategory(models.Model):\n    name = models.CharField(max_length=50)\n\n    def __str__(self):\n        # pylint: disable=invalid-str-returned\n        return self.name\n\n\nclass Resource(models.Model):\n    title = models.CharField(max_length=100)\n    category = models.ForeignKey(ResourceCategory, on_delete=models.CASCADE)\n\n    def __str__(self):\n        # pylint: disable=invalid-str-returned\n        return self.title\n\n\nclass ResourceAllocation(models.Model):\n    shift = models.ForeignKey(Shift, on_delete=models.CASCADE)\n    resources = models.ManyToManyField(Resource, blank=True)\n\n    def __str__(self):\n        return f\"Resource allocation for {self.shift}\"\n", "path": "ephios/plugins/simpleresource/models.py"}, {"content": "from django.forms import BaseModelFormSet, BooleanField, ModelForm, modelformset_factory\nfrom django.forms.formsets import DELETION_FIELD_NAME\nfrom django.utils.translation import gettext as _\nfrom django_select2.forms import Select2MultipleWidget\n\nfrom ephios.core.forms.events import BasePluginFormMixin\nfrom ephios.plugins.simpleresource.models import ResourceAllocation, ResourceCategory\n\n\nclass ResourceAllocationForm(BasePluginFormMixin, ModelForm):\n    class Meta:\n        model = ResourceAllocation\n        fields = [\"resources\"]\n        widgets = {\n            \"resources\": Select2MultipleWidget,\n        }\n\n    def __init__(self, *args, shift, **kwargs):\n        self.shift = shift\n        try:\n            kwargs.setdefault(\"instance\", ResourceAllocation.objects.get(shift=shift))\n        except ResourceAllocation.DoesNotExist:\n            pass\n        super().__init__(*args, **kwargs)\n\n    def save(self, commit=True):\n        if self.cleaned_data.get(\"resources\"):\n            self.instance.shift = self.shift\n            super().save(commit)\n        elif self.instance.pk:\n            self.instance.delete()\n\n    @property\n    def heading(self):\n        return _(\"Resource allocation\")\n\n    def is_function_active(self):\n        return bool(self.instance.resources.exists())\n\n\nclass BaseResourceCategoryFormset(BaseModelFormSet):\n    def add_fields(self, form, index):\n        super().add_fields(form, index)\n        initial_form_count = self.initial_form_count()\n        if self.can_delete and (self.can_delete_extra or index < initial_form_count):\n            category: ResourceCategory = form.instance\n            form.fields[DELETION_FIELD_NAME] = BooleanField(\n                label=_(\"Delete\"),\n                required=False,\n                disabled=category.pk and category.resource_set.exists(),\n            )\n\n\nResourceCategoryFormset = modelformset_factory(\n    ResourceCategory,\n    formset=BaseResourceCategoryFormset,\n    can_delete=True,\n    extra=0,\n    fields=[\"name\"],\n)\n", "path": "ephios/plugins/simpleresource/forms.py"}], "after_files": [{"content": "from django.db import models\nfrom django.utils.translation import gettext_lazy as _\n\nfrom ephios.core.models import Shift\n\n\nclass ResourceCategory(models.Model):\n    name = models.CharField(max_length=50, verbose_name=_(\"Name\"))\n\n    def __str__(self):\n        # pylint: disable=invalid-str-returned\n        return self.name\n\n\nclass Resource(models.Model):\n    title = models.CharField(max_length=100, verbose_name=_(\"Title\"))\n    category = models.ForeignKey(\n        ResourceCategory, on_delete=models.CASCADE, verbose_name=_(\"Category\")\n    )\n\n    def __str__(self):\n        # pylint: disable=invalid-str-returned\n        return self.title\n\n\nclass ResourceAllocation(models.Model):\n    shift = models.ForeignKey(Shift, on_delete=models.CASCADE)\n    resources = models.ManyToManyField(Resource, blank=True, verbose_name=_(\"Resources\"))\n\n    def __str__(self):\n        return f\"Resource allocation for {self.shift}\"\n", "path": "ephios/plugins/simpleresource/models.py"}, {"content": "from crispy_forms.helper import FormHelper\nfrom django.forms import BaseModelFormSet, BooleanField, ModelForm, modelformset_factory\nfrom django.forms.formsets import DELETION_FIELD_NAME\nfrom django.utils.translation import gettext as _\nfrom django_select2.forms import Select2MultipleWidget\n\nfrom ephios.core.forms.events import BasePluginFormMixin\nfrom ephios.plugins.simpleresource.models import ResourceAllocation, ResourceCategory\n\n\nclass ResourceAllocationForm(BasePluginFormMixin, ModelForm):\n    class Meta:\n        model = ResourceAllocation\n        fields = [\"resources\"]\n        widgets = {\n            \"resources\": Select2MultipleWidget,\n        }\n\n    def __init__(self, *args, shift, **kwargs):\n        self.shift = shift\n        self.helper = FormHelper()\n        self.helper.include_media = False\n        try:\n            kwargs.setdefault(\"instance\", ResourceAllocation.objects.get(shift=shift))\n        except ResourceAllocation.DoesNotExist:\n            pass\n        super().__init__(*args, **kwargs)\n\n    def save(self, commit=True):\n        if self.cleaned_data.get(\"resources\"):\n            self.instance.shift = self.shift\n            super().save(commit)\n        elif self.instance.pk:\n            self.instance.delete()\n\n    @property\n    def heading(self):\n        return _(\"Resource allocation\")\n\n    def is_function_active(self):\n        return bool(self.instance.resources.exists())\n\n\nclass BaseResourceCategoryFormset(BaseModelFormSet):\n    def add_fields(self, form, index):\n        super().add_fields(form, index)\n        initial_form_count = self.initial_form_count()\n        if self.can_delete and (self.can_delete_extra or index < initial_form_count):\n            category: ResourceCategory = form.instance\n            form.fields[DELETION_FIELD_NAME] = BooleanField(\n                label=_(\"Delete\"),\n                required=False,\n                disabled=category.pk and category.resource_set.exists(),\n            )\n\n\nResourceCategoryFormset = modelformset_factory(\n    ResourceCategory,\n    formset=BaseResourceCategoryFormset,\n    can_delete=True,\n    extra=0,\n    fields=[\"name\"],\n)\n", "path": "ephios/plugins/simpleresource/forms.py"}]}