[Fixed]-Database submission to postgres from HTML form

1👍

You need to create a registration view.

The url() function expects a view, and will call the get function on that view.
At present you are giving the registration url a model to run. Its trying to run the get method, but your model doesn’t have one, hence the error.

in your view file try something along the lines of:

class RegistrationView(FormView):
    model = Registration
    template_name = 'path to your tamplate here'
    def get(self, *args, **kwrags):
         # code here to display the empty form
    def post(self, *args, **kwrags):
         # code here to handle the request with a populated form. 

That example is for a class based FormView.
https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-editing/#formview

It might be easier to use a function based view to begin with (more typing, less ‘magic’).
Probably its a good idea to read through the relevant documentation:
https://docs.djangoproject.com/en/1.9/topics/forms/

Leave a comment