-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,9 @@ | |||
rom django import forms |
There was a problem hiding this comment.
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.
Thanks, I'm glad you're contributing! I think the best place for this class is in the existing The Once you're ready to start working in on the view, you can add it to the existing I think we can have it simply email the "managers" of the site. Django provides a nice You'll also need a simple template that renders the form. You can mimic something like this, which inherits the base template and renders the form as a table: https://github.com/codeforkyana/renters-rights/blob/master/renters_rights/noauth/templates/log-in.html.
Let me know if you have any questions or need any help! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work so far!
There are some Django-specific changes we should make so the form can accept a large comment and support translation.
class NameForm(forms.form): | ||
your_email = forms.CharField(label = 'Your Email', max_length = 100) | ||
your_name = forms.CharField(label = 'Your Name', max_length = 100) | ||
your_comments = forms.CharField(label = 'Your Comments', max_length = 100) |
There was a problem hiding this comment.
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.
rom django import forms | ||
|
||
class NameForm(forms.form): | ||
your_email = forms.CharField(label = 'Your Email', max_length = 100) |
There was a problem hiding this comment.
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.
Thanks. It's glad to know I wasn't entirely off. I will look at it this week and now I know where you want the .js to go.
________________________________
From: Bret Walker <[email protected]>
Sent: Sunday, April 12, 2020 10:36 PM
To: codeforkyana/renters-rights <[email protected]>
Cc: purplephoenix92 <[email protected]>; Author <[email protected]>
Subject: Re: [codeforkyana/renters-rights] new branch created change added to make a contactus py form (#32)
@bretwalker requested changes on this pull request.
Great work so far!
There are some Django-specific changes we should make so the form can accept a large comment and support translation.
________________________________
In renters_rights/units/contactus.py<#32 (comment)>:
@@ -0,0 +1,9 @@
+rom django import forms
+
+class NameForm(forms.form):
+ your_email = forms.CharField(label = 'Your Email', max_length = 100)
+ your_name = forms.CharField(label = 'Your Name', max_length = 100)
+ your_comments = forms.CharField(label = 'Your Comments', max_length = 100)
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.
________________________________
In renters_rights/units/contactus.py<#32 (comment)>:
@@ -0,0 +1,9 @@
+rom django import forms
+
+class NameForm(forms.form):
+ your_email = forms.CharField(label = 'Your Email', max_length = 100)
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#32 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALD2EM4NJMXM4XZCJQTAVVTRMI7AXANCNFSM4MGIQFCQ>.
|
Made a contact us . py form and created a branch to commit possible changes. I wanted to make sure that I was following the guide that you referenced in get started guide and using the working with forms. The next thing that I was going to do is install docker in a round a bout way and then add the necessary pieces in the views.py next hopefully. I'm not for sure if it is the app.js that you want to possibly add the piece that was missing there, the async did mount (?)