PhysikOnline-FFM / po-fp-backend

MIT License
0 stars 0 forks source link

500 bei Anmeldung auf Warteliste #50

Closed larsgroeber closed 6 years ago

larsgroeber commented 6 years ago

Response

AttributeError at /api/waitlist/
'FpWaitlist' object has no attribute 'partner'

Request Method: POST
Request URL: http://po-fp-staging.physikelearning.de/api/waitlist/
Django Version: 1.11
Python Executable: /usr/local/bin/python
Python Version: 3.6.3
Python Path: ['/app', '/usr/local/bin', '/usr/local/lib/python36.zip', '/usr/local/lib/python3.6', '/usr/local/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-packages', '/src/django-import-export', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf', '/usr/local/lib/python3.6/site-packages/odf']
Server time: Sun, 4 Mar 2018 21:54:44 +0000
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'fpraktikum',
 'django_extensions',
 'rest_framework',
 'corsheaders',
 'drf_yasg',
 'import_export']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware']

Traceback:  

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/rest_framework/viewsets.py" in view
  95.             return self.dispatch(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
  494.             response = self.handle_exception(exc)

File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py" in handle_exception
  454.             self.raise_uncaught_exception(exc)

File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
  491.             response = handler(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/rest_framework/mixins.py" in create
  21.         self.perform_create(serializer)

File "/app/fpraktikum/api_views.py" in perform_create
  269.         send_email(user, "waitlist_reg")

File "/app/fpraktikum/utils.py" in send_email
  107.         partner = data_serializer.partner

Request

POST: https://po-fp-staging.physikelearning.de/api/waitlist/
{
  "user_firstname": "Lars",
  "user_lastname": "Gröber",
  "user_login": "LarsG_admin",
  "user_mail": "email@email.com",
  "user_matrikel": "doesNotExist",
  "graduation": "BA",
  "notes": "\"\"",
  "institutes": [
    {
      "id": 1,
      "name": "IAP",
      "graduation": "BA",
      "places": 8,
      "semesterhalf": 1,
      "notes": null
    },
    {
      "id": 3,
      "name": "PI",
      "graduation": "BA",
      "places": 8,
      "semesterhalf": 2,
      "notes": null
    }
  ],
  "status": null,
  "partner": null,
  "institute_firsthalf": "IAP",
  "institute_secondhalf": "PI"
}
chgad commented 6 years ago

@Larsg7 the Waitlist Endpoint does not expect a "partner": <value> key-value pair. Just remove this Key and it should work perfect.

larsgroeber commented 6 years ago

Request

{
  "user_firstname": "Lars",
  "user_lastname": "Gr\u00f6ber",
  "user_login": "s0053274",
  "user_mail": "s000@email.com",
  "user_matrikel": "doesNotExist",
  "graduation": "BA",
  "notes": "\"\"",
  "institutes": [
    {
      "id": 1,
      "name": "IAP",
      "graduation": "BA",
      "places": 8,
      "semesterhalf": 1,
      "notes": null
    },
    {
      "id": 3,
      "name": "PI",
      "graduation": "BA",
      "places": 8,
      "semesterhalf": 2,
      "notes": null
    }
  ],
  "status": null,
  "institute_firsthalf": "IAP",
  "institute_secondhalf": "PI"
}

Response

AttributeError at /api/waitlist/
'FpWaitlist' object has no attribute 'partner'
+siehe oben
larsgroeber commented 6 years ago

Ok, request geht aber trotzdem durch und Nutzer wird auf die Warteliste geschrieben => Beim zweiten Versuch gibt es einen 400 Fehler und Nutzer steht in der Warteliste Tabelle.

larsgroeber commented 6 years ago

Gleicher Fehler beim Abmelden von der Warteliste.

chgad commented 6 years ago

Sorry, my fault didn't read the Traceback carefully. It's an issue of the email function. Will be fixed soon.

chgad commented 6 years ago

Fixed via #52