Skip to content

Conversation

@gitumarkk
Copy link
Contributor

  • Added google forms and removed registration code.
  • Made html edits.
  • Did south migrations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetical order.
The South stuff isn't in here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Dynamic_Section being used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas to check if section is enabled, the menu and the registration page depends on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this functionality be covered in Registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas now that the registration form depends only on one field in the django admin, will do that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where the comment disappeared to.
Ok, so looking closer at this code - your indentation is wrong (if is in the for)
Also, this data is filled in server side - i.e. user hasn't touched this yet, what field.errors are you expecting?

Any reason to use something more than:

{% csrf_token %} {{ form.as_p }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas I assume that javascript will not be working all the time for all users hence server side validation serves as a back up, I think it provides significant benefits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this code is converted into html BEFORE the data is sent to the user's browser to be rendered. I.e. this becomes static html. The fields you're using can be used to display client-side validation errors.
https://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template

You should definitely have server side validation, but this isn't it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas basically what is happening initially from what I understand when the form gets rendered initially, the errors defaults to false, then as the user is filling in data if any is wrong the javascript catches this error, however if for some reason the javascript is broken i.e. disabled in the browser, form validation is repeated in the views.py file i.e. form.validate() function, if this returns false, the form is re-rendered this time the error defaults to true and the required error message is given (but I could be wrong in that case I will remove it).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas it was what was validating the forms before the javascript was introduced, and it is also what is working in the unittests (https://github.com/gitumarkk/DjangoWebsite/blob/develop/umonya/umonya/apps/main/tests/test_forms.py)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

form_url
Make this a URL field...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the ability to specify registration is open or closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninas <iframe> causes validation errors and doesn't save in database as I think the URLField is meant for http//: urls If there is no form code in database registration is closed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All that's going to change is the url - you don't need to include the whole iframe html stuff as well - just change which url is used by the iframe, and store only that. Does that make sense?
Also: http://stackoverflow.com/questions/8778416/what-are-the-valid-values-for-a-django-url-field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants