I have want to have an endpoint which is called by a third party which the parameter names they will use can't be changed. The submitted data contains parameters with the character .
(e.g. hub.token
) along with others.
I had wanted to create a Django form to validate the callback but how does one write a form class which will bind to the request. Without noticing the problem I tried hub.token
which does not work as hub
dictionary does not exist. I then tried hub_token
in the hope Django would recognise the intent.
Having a period in the attribute is valid as in HTML form submission the name is taken the controls name attribute which can contain periods.
Is there an easy way to handle this situation without having to access each field in the view?
forms.py
from django import forms
class RegisterEndpointForm(forms.Form):
hub.token = forms.CharField()
views.py
...
register_request = RegisterEndpointForm(request.GET)
if register_request.is_valid()
pass
...