Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new branch created change added to make a contactus py form #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions renters_rights/units/contactus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rom django import forms
Copy link
Member

@bretwalker bretwalker Apr 12, 2020

Choose a reason for hiding this comment

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

This will need to be from django.... Small typo. But I think it'd be better to move your form class to another place in the codebase. See the comment I left on the main PR for more info.


class NameForm(forms.form):
your_email = forms.CharField(label = 'Your Email', max_length = 100)
Copy link
Member

Choose a reason for hiding this comment

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

One small change to your labels. We want these to be able to be translated into other languages easily, and Django facilitates that through their translation module.

In the forms module, you'll see a line like from django.utils.translation import gettext_lazy as _. And then strings wrapped in _(). This makes them easy to export for translation and translatable at runtime.

So for your labels, could you wrap them in _()? For example, label='Your Name would become _('Your name').

When you move this form class to the forms module, _ will have been imported for you, so you won't need to import it.

your_name = forms.CharField(label = 'Your Name', max_length = 100)
your_comments = forms.CharField(label = 'Your Comments', max_length = 100)
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to add widget=forms.Textarea to this field so it renders as a multiline text area.
And let's make the max_length 10,000.