internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: svthalia/concrexit

Issue:
Error in pizza admin related to title_en
Sentry Issue: [CONCREXIT-9W](https://sentry.io/organizations/thalia/issues/2692657224/?referrer=github_integration)

```
FieldError: Related Field got invalid lookup: title_en
(16 additional frame(s) were not displayed)
...
  File "django/db/models/sql/query.py", line 1393, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "django/db/models/sql/query.py", line 1412, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1265, in build_filter
    return self._add_q(
  File "django/db/models/sql/query.py", line 1412, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1339, in build_filter
    raise FieldError('Related Field got invalid lookup: {}'.format(lookups[0]))
```


Discussion:
It's in the search fields: https://github.com/svthalia/concrexit/blob/master/website/pizzas/admin.py#L32

Resolving patch:
diff --git a/website/pizzas/admin.py b/website/pizzas/admin.py
--- a/website/pizzas/admin.py
+++ b/website/pizzas/admin.py
@@ -1,5 +1,4 @@
 """Registers admin interfaces for the pizzas module."""
-from django.conf import settings
 from django.contrib import admin
 from django.core.exceptions import PermissionDenied
 from django.forms import Field
@@ -31,7 +30,7 @@ class FoodEventAdmin(admin.ModelAdmin):
     list_display = ("title", "start", "end", "notification_enabled", "orders")
     date_hierarchy = "start"
     exclude = ("end_reminder",)
-    search_fields = [f"event__title_{l[0]}" for l in settings.LANGUAGES]
+    search_fields = ("event__title",)
     autocomplete_fields = ("event",)
 
     def notification_enabled(self, obj):


Test patch:
Repository: svthalia/concrexit

Issue:
Use API v2 for pizza orders
### Is your feature request related to a problem? Please describe.
For some reason (#1931) the payment widget of the order overview page is broken. 

### Describe the solution you'd like
Instead of debugging the existing code, I prefer switching API v2 immedaitely.

### Motivation
Better

### Describe alternatives you've considered
Debugging 

### Additional context



Discussion:

Resolving patch:
diff --git a/website/pizzas/api/v2/admin/urls.py b/website/pizzas/api/v2/admin/urls.py
--- a/website/pizzas/api/v2/admin/urls.py
+++ b/website/pizzas/api/v2/admin/urls.py
@@ -28,7 +28,7 @@
     path(
         "food/events/<int:event_id>/orders/<int:pk>/",
         FoodOrderAdminDetailView.as_view(),
-        name="event-registration-detail",
+        name="food-event-order-detail",
     ),
     path("food/products/", ProductsAdminListView.as_view(), name="food-products-index"),
     path(


Test patch:
Repository: svthalia/concrexit

Issue:
Registration message in calendar wrong
### Describe the bug
In the calendar, when you have to register for an event, it says in the block; You can register on .......
However, this seems to be the date of when the event will take place (or the registration deadline, can't tell for sure).
See screenshots for an example.

### How to reproduce
Steps to reproduce the behaviour:
1. Go to the calendar and look for an event with a registration.
2. Look at the message in the calendar view
3. Compare with the registration date in the event itself.

### Expected behaviour
The message in the calendar view matches the date of when the registrations will open.

### Screenshots
![image](https://user-images.githubusercontent.com/12615607/139580635-4f56710d-23ae-4680-a45d-ace2376cfeb7.png)
![image](https://user-images.githubusercontent.com/12615607/139580729-88d92dcd-e60d-4d13-8505-107fc2b69b14.png)



Discussion:
Thanks for the elaborate issue! Looks like it is indeed using the registration deadline in the text.

Resolving patch:
diff --git a/website/events/api/calendarjs/serializers.py b/website/events/api/calendarjs/serializers.py
--- a/website/events/api/calendarjs/serializers.py
+++ b/website/events/api/calendarjs/serializers.py
@@ -50,7 +50,7 @@ def _registration_info(self, instance: Event):
                 return _("You are registered for this event")
         # Optional registration possible
         elif instance.optional_registration_allowed:
-            return _("You can optionally register for this event")
+            return _("Registering for this event is optional")
         # No places left
         elif instance.reached_participants_limit():
             return _("You can put yourself on the waiting list for this event")
@@ -62,13 +62,13 @@ def _registration_info(self, instance: Event):
             now = timezone.now()
             if instance.registration_end < now:
                 return _("Registrations have been closed")
-            elif instance.registration_end <= now + timedelta(days=2):
-                return _("You can register {at_time}").format(
-                    at_time=naturaltime(instance.registration_end)
+            elif instance.registration_start <= now + timedelta(days=2):
+                return _("Registrations open {at_time}").format(
+                    at_time=naturaltime(instance.registration_start)
                 )
             else:
-                return _("You can register on {date}").format(
-                    date=date(instance.registration_end)
+                return _("Registrations open {date}").format(
+                    date=date(instance.registration_start)
                 )
 
 


Test patch:
Repository: svthalia/concrexit

Issue:
Base64 encode OIDC_RSA_PRIVATE_KEY
### Describe the bug
Make sure no newlines are needed in the environment variable by base64 encoding



Discussion:

Resolving patch:
diff --git a/website/thaliawebsite/settings.py b/website/thaliawebsite/settings.py
--- a/website/thaliawebsite/settings.py
+++ b/website/thaliawebsite/settings.py
@@ -514,9 +514,13 @@ def from_env(
 CORS_URLS_REGEX = r"^/(?:api/v1|api/v2|user/oauth)/.*"
 
 # OAuth configuration
+OIDC_RSA_PRIVATE_KEY = from_env("OIDC_RSA_PRIVATE_KEY", testing=None)
+if OIDC_RSA_PRIVATE_KEY is not None:
+    OIDC_RSA_PRIVATE_KEY = base64.urlsafe_b64decode(OIDC_RSA_PRIVATE_KEY)
+
 OAUTH2_PROVIDER = {
     "OIDC_ENABLED": True,
-    "OIDC_RSA_PRIVATE_KEY": from_env("OIDC_RSA_PRIVATE_KEY", testing=None),
+    "OIDC_RSA_PRIVATE_KEY": OIDC_RSA_PRIVATE_KEY,
     "ALLOWED_REDIRECT_URI_SCHEMES": setting(
         production=["https", APP_OAUTH_SCHEME],
         staging=["http", "https", APP_OAUTH_SCHEME],


Test patch:
Repository: svthalia/concrexit

Issue:
Vacancy detail view in API does not work
### Describe the bug
The API detail view for vacancies seem to be broken. 

### How to reproduce
Steps to reproduce the behaviour:
1. Go to `/api/v2/partners/vacancies/1/`
2. Crash!

### Expected behaviour
Should work.



Discussion:

Resolving patch:
diff --git a/website/partners/api/v2/views.py b/website/partners/api/v2/views.py
--- a/website/partners/api/v2/views.py
+++ b/website/partners/api/v2/views.py
@@ -1,4 +1,3 @@
-from django.db.models import query
 from oauth2_provider.contrib.rest_framework import IsAuthenticatedOrTokenHasScope
 from rest_framework import filters as framework_filters
 from rest_framework.generics import ListAPIView, RetrieveAPIView
@@ -82,6 +81,6 @@ class VacancyDetailView(RetrieveAPIView):
     """Returns a single vacancy."""
 
     serializer_class = VacancySerializer
-    queryset = Partner.objects.all()
+    queryset = Vacancy.objects.all()
     permission_classes = [IsAuthenticatedOrTokenHasScope]
     required_scopes = ["partners:read"]


Test patch:
Repository: svthalia/concrexit

Issue:
Order payments by date in payment inline in payment user admin 
### Is your feature request related to a problem? Please describe.
The PaymentUserAdmin features a PaymentInline for all payments a user made. Those payments right should be ordered by date (I think they are ordered alphabetically right now)

### Describe the solution you'd like
Order the payments inline by date (and possibly globally order them by date by setting it in the meta field of the payment model)

### Motivation
More intuitive model




Discussion:

Resolving patch:
diff --git a/website/payments/admin.py b/website/payments/admin.py
--- a/website/payments/admin.py
+++ b/website/payments/admin.py
@@ -570,6 +570,7 @@ class PaymentInline(admin.TabularInline):
         "notes",
         "batch",
     )
+    ordering = ("-created_at",)
 
     show_change_link = True
 


Test patch:
Repository: svthalia/concrexit

Issue:
Add correct cache headers
### Describe the bug
We used to apply the `Expires` css header in nginx. When we moved to Nix this was removed. We should maybe check out which headers we should add to make sure /static is properly cached



Discussion:

Resolving patch:
diff --git a/website/thaliawebsite/settings.py b/website/thaliawebsite/settings.py
--- a/website/thaliawebsite/settings.py
+++ b/website/thaliawebsite/settings.py
@@ -651,6 +651,15 @@ def from_env(
     "compressor.finders.CompressorFinder",
 )
 
+NORMAL_STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
+MANIFEST_STATICFILES_STORAGE = (
+    "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
+)
+STATICFILES_STORAGE = setting(
+    development=NORMAL_STATICFILES_STORAGE,
+    production=MANIFEST_STATICFILES_STORAGE,
+)
+
 # Compressor settings
 COMPRESS_ENABLED = True
 
diff --git a/website/thaliawebsite/storage/__init__.py b/website/thaliawebsite/storage/__init__.py
new file mode 100644
--- /dev/null
+++ b/website/thaliawebsite/storage/__init__.py
@@ -0,0 +1 @@
+from .manifest import *
diff --git a/website/thaliawebsite/storage/manifest.py b/website/thaliawebsite/storage/manifest.py
new file mode 100644
--- /dev/null
+++ b/website/thaliawebsite/storage/manifest.py
@@ -0,0 +1,10 @@
+from django.conf import settings
+from django.contrib.staticfiles.storage import (
+    ManifestStaticFilesStorage as ParentStorage,
+)
+
+
+class ManifestStaticFilesStorage(ParentStorage):
+    def __init__(self, *args, **kwargs):
+        self.manifest_strict = settings.STATICFILES_STORAGE_STRICT
+        super().__init__(*args, **kwargs)


Test patch:
Repository: svthalia/concrexit

Issue:
Visual quirk in the login failure message
### Describe the bug
When you fail to log in on desktop (or probably any wider screen) the message saying this shows up on the left and the login fields are offset to the right. I would expect the message to appear on top, while the login fields were to stay in the same horizontal position.

### How to reproduce
Steps to reproduce the behaviour:
1. Go to the login page
2. Enter invalid credentials

### Expected behaviour
The login fields do not move to the right. The error message is either shown above the login fields or next to them.

### Screenshots
![Screenshot from 2022-01-27 16-20-21](https://user-images.githubusercontent.com/12382856/151389280-ed564ad7-e792-41a4-98fc-713a14cbce83.png)


### Additional context
Not sure in what other situations these message boxes are used, but it may occur in other places too. Haven't checked.



Discussion:
![Screenshot 2022-01-27 at 17 03 40](https://user-images.githubusercontent.com/1799914/151396537-79bcc117-435f-4b4e-98e8-f808d1e9f03d.png)

This does no longer happen on staging, however there we can see that the close button has a double X and it doesn't work. We moved to bootstrap5 yesterday. So the solution for your issue is probably that and also the thing that causes the closing not working.

Resolving patch:
diff --git a/website/thaliawebsite/templatetags/alert.py b/website/thaliawebsite/templatetags/alert.py
--- a/website/thaliawebsite/templatetags/alert.py
+++ b/website/thaliawebsite/templatetags/alert.py
@@ -6,7 +6,7 @@
 @register.inclusion_tag("includes/alert.html")
 def alert(alert_type="info", message=None, dismissible=False, extra_classes=""):
     if dismissible:
-        extra_classes += " alert-dimissable"
+        extra_classes += " alert-dismissible"
     return {
         "type": alert_type,
         "message": message,


Test patch:
Repository: svthalia/concrexit

Issue:
Change prefix of summaries on the website
### Is your feature request related to a problem? Please describe.
Titles of summaries usually say e.g. "Summary System Theory Summary", because people send in files called "System theory summary". 

### Describe the solution you'd like
Titles can be changed by adding a semicolon after the first "summary", or by changing file titles. 

### Motivation
It's much more clear.



Discussion:
The Educacie should be able to correct these summaries. However, it is probably just better to remove the prefix from the view rendering.
https://github.com/svthalia/concrexit/blob/master/website/education/views.py#L85

Resolving patch:
diff --git a/website/education/views.py b/website/education/views.py
--- a/website/education/views.py
+++ b/website/education/views.py
@@ -82,7 +82,7 @@ def get_context_data(self, **kwargs) -> dict:
                 items[summary.year]["summaries"].append(
                     {
                         "year": summary.year,
-                        "name": f'{_("Summary")} {summary.name}',
+                        "name": summary.name,
                         "language": summary.language,
                         "id": summary.id,
                     }


Test patch:
Repository: svthalia/concrexit

Issue:
Add filter/display of members-only value to document admin
### Is your feature request related to a problem? Please describe.
It is not really issue to see which documents are marked as members only. And it is impossible to easily get a list with documents that have a true/false value.

### Describe the solution you'd like
I'd like to see more information about the documents in the admin page so that I do not have to open the detail page.

### Motivation
Easier to manage these files.

### Describe alternatives you've considered
The only alternative is not doing this.

### Additional context
#2084 could have been prevented.



Discussion:

Resolving patch:
diff --git a/website/documents/admin.py b/website/documents/admin.py
--- a/website/documents/admin.py
+++ b/website/documents/admin.py
@@ -69,6 +69,11 @@ class AnnualDocumentAdmin(ModelAdmin):
         LectureYearFilter,
         "created",
         "last_updated",
+        "members_only",
+    )
+    list_display = (
+        "__str__",
+        "members_only",
     )
 
 
@@ -80,6 +85,11 @@ class AssociationDocumentAdmin(ModelAdmin):
     list_filter = (
         "created",
         "last_updated",
+        "members_only",
+    )
+    list_display = (
+        "__str__",
+        "members_only",
     )
 
 
@@ -91,6 +101,11 @@ class EventDocumentAdmin(ModelAdmin):
     list_filter = (
         "created",
         "last_updated",
+        "members_only",
+    )
+    list_display = (
+        "__str__",
+        "members_only",
     )
 
     def has_change_permission(self, request, obj=None):
@@ -114,4 +129,9 @@ class MiscellaneousDocumentAdmin(ModelAdmin):
     list_filter = (
         "created",
         "last_updated",
+        "members_only",
+    )
+    list_display = (
+        "__str__",
+        "members_only",
     )


Test patch:
Repository: svthalia/concrexit

Issue:
Date format for events
<!--

Please add the appropriate label for what change should be made:
docs: changes to the documentation)
refactor: refactoring production code, eg. renaming a variable or rewriting a function
test: adding missing tests, refactoring tests; no production code change
chore: updating poetry etc; no production code change

-->

### Describe the change
Change the date format for events from { MMM. DD, YYYY, H A } (see additional context)
to { EEE, DD - MMMM - YYYY, HH:MM }.

### Motivation
The current dateformat is following the US style, according to the spelling in the styleguide we use British English (Colour), and we are EU based.
So the date format should also follow the British English date format (a.m./p.m. is mostly used in the US, Australia and Canada), throughout Europe 24-hour notation is used.

### Additional context
Current: ![image](https://user-images.githubusercontent.com/33718602/146271152-5853aac7-cf7f-4458-afcc-3c9315e9bb75.png)



Discussion:
Something to keep consider is that the newsletter uses 24-hour notation and 3-character abbreviations:

<img width="225" alt="image" src="https://user-images.githubusercontent.com/41264528/149205190-0c1171a8-f6ee-4ff1-8cad-423ac050e7fc.png">


Resolving patch:
diff --git a/website/thaliawebsite/settings.py b/website/thaliawebsite/settings.py
--- a/website/thaliawebsite/settings.py
+++ b/website/thaliawebsite/settings.py
@@ -627,13 +627,15 @@ def from_env(
 # Internationalization
 # https://docs.djangoproject.com/en/dev/topics/i18n/
 
+DATETIME_FORMAT = "j M, Y, H:i"
+
 LANGUAGE_CODE = "en"
 
 TIME_ZONE = "Europe/Amsterdam"
 
 USE_I18N = True
 
-USE_L10N = True
+USE_L10N = False
 
 USE_TZ = True
 


Test patch:
Repository: svthalia/concrexit

Issue:
Alumni page is broken on staging
### Describe the bug

`type object 'Event' has no attribute 'CATEGORY_ALUMNI'`

https://sentry.io/organizations/thalia/issues/3014595509/

### How to reproduce
Steps to reproduce the behaviour:
1. Go to https://staging.thalia.nu/association/alumni/
2. 500 error!

### Expected behaviour
Should show the alumni page.

### Additional context
The categories were moved out of the event file in a PR that was merged last week.



Discussion:

Resolving patch:
diff --git a/website/events/services.py b/website/events/services.py
--- a/website/events/services.py
+++ b/website/events/services.py
@@ -7,7 +7,12 @@
 
 from events import emails
 from events.exceptions import RegistrationError
-from events.models import EventRegistration, RegistrationInformationField, Event
+from events.models import (
+    categories,
+    EventRegistration,
+    RegistrationInformationField,
+    Event,
+)
 from payments.api.v1.fields import PaymentTypeField
 from payments.services import create_payment, delete_payment
 from utils.snippets import datetime_to_lectureyear
@@ -332,11 +337,12 @@ def generate_category_statistics() -> dict:
     data = {
         "labels": [str(current_year - 4 + i) for i in range(5)],
         "datasets": [
-            {"label": str(display), "data": []} for _, display in Event.EVENT_CATEGORIES
+            {"label": str(display), "data": []}
+            for _, display in categories.EVENT_CATEGORIES
         ],
     }
 
-    for index, (key, _) in enumerate(Event.EVENT_CATEGORIES):
+    for index, (key, _) in enumerate(categories.EVENT_CATEGORIES):
         for i in range(5):
             year_start = date(year=current_year - 4 + i, month=9, day=1)
             year_end = date(year=current_year - 3 + i, month=9, day=1)
diff --git a/website/events/views.py b/website/events/views.py
--- a/website/events/views.py
+++ b/website/events/views.py
@@ -12,6 +12,7 @@
 
 from events import services
 from events.exceptions import RegistrationError
+from events.models import categories
 from payments.models import Payment
 from .forms import FieldsForm
 from .models import Event, EventRegistration
@@ -82,7 +83,7 @@ def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
 
         events = Event.objects.filter(
-            published=True, category=Event.CATEGORY_ALUMNI, end__gte=timezone.now()
+            published=True, category=categories.CATEGORY_ALUMNI, end__gte=timezone.now()
         ).order_by("end")[:3]
         context["events"] = events
 


Test patch:
Repository: svthalia/concrexit

Issue:
Don't revoke staff status for superusers
### Describe the bug
After #312, staff status will get revoked for superusers too. That shouldn't happen

### How to reproduce
Have a super user that is not in a committee.

### Expected behaviour
No staff status revoking

### Screenshots

### Additional context



Discussion:

Resolving patch:
diff --git a/website/activemembers/services.py b/website/activemembers/services.py
--- a/website/activemembers/services.py
+++ b/website/activemembers/services.py
@@ -36,7 +36,7 @@ def revoke_staff_permission_for_users_in_no_commitee():
     members = Member.objects.filter(is_staff=True)
     revoked = []
     for member in members:
-        if member.get_member_groups().count() == 0:
+        if member.get_member_groups().count() == 0 and not member.is_superuser:
             revoked.append(member.id)
             member.is_staff = False
             member.save()


Test patch:
Repository: svthalia/concrexit

Issue:
Digitpaint vacancy returns a 404
### Describe the bug
When clicking 'learn more' on the Digitpaint vacancy card the server returns a 404.

### How to reproduce
Steps to reproduce the behaviour:
1. Go to 'Vacancies'
2. Scroll down to the Digitpaint card
3. Click 'learn more'
4. See error

### Expected behaviour
Be shown a page with more information about Digitpaint.

### Additional context
Their logo also has some white pixels around the black text that does not work well with a dark background.



Discussion:
The expected behaviour is actually that we scroll down to the bottom of the page to open the vacancy that is located there. Digitpaint has no partner page with information.
Right, that makes sense.
Ordina seems to have the same issue and others, like GX software, don't go anywhere.
My findings so far:
- It seems like the partners that give 404's are not active. So should their vacancies not also be inactive?
- Scrolling within the page should happen (like @se-bastiaan mentioned), but that does not seem to happen, although I don't know why.
Apparently this is a duplicate of #2039 at least for the 404.

Resolving patch:
diff --git a/website/partners/models.py b/website/partners/models.py
--- a/website/partners/models.py
+++ b/website/partners/models.py
@@ -177,7 +177,7 @@ def __str__(self):
     def get_absolute_url(self):
         """Return partner or vacancy url."""
         url = reverse("partners:vacancies")
-        if self.partner:
+        if self.partner and self.partner.is_active:
             url = reverse("partners:partner", args=(self.partner.slug,))
         return f"{url}#vacancy-{self.pk}"
 
diff --git a/website/partners/templatetags/partner_cards.py b/website/partners/templatetags/partner_cards.py
--- a/website/partners/templatetags/partner_cards.py
+++ b/website/partners/templatetags/partner_cards.py
@@ -59,7 +59,7 @@ def vacancy_card(vacancy):
     url = "#vacancy-{}".format(vacancy.id)
     keywords = vacancy.keywords.split(",")
     location = vacancy.location
-    if vacancy.partner:
+    if vacancy.partner and vacancy.partner.is_active:
         url = "{}#vacancy-{}".format(vacancy.partner.get_absolute_url(), vacancy.id)
         extra_class = ""
 


Test patch: