Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
71be3bf3
Commit
71be3bf3
authored
Mar 06, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Own registration page asking for full name as well
parent
9eb9753b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
33 deletions
+24
-33
TODO
TODO
+0
-1
accounts/forms.py
accounts/forms.py
+18
-1
html/registration/registration_form.html
html/registration/registration_form.html
+4
-30
urls.py
urls.py
+2
-1
No files found.
TODO
View file @
71be3bf3
Things to implement before first public release
* Password change/reset pages
* Registration should ask for name
Possible features for future releases
...
...
accounts/forms.py
View file @
71be3bf3
...
...
@@ -33,4 +33,21 @@ class ContactForm(forms.Form):
)
class
RegistrationForm
(
RegistrationFormUniqueEmail
):
pass
first_name
=
forms
.
CharField
(
label
=
_
(
'First name'
))
last_name
=
forms
.
CharField
(
label
=
_
(
'Last name'
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
RegistrationForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'username'
].
label
=
_
(
'Username'
)
self
.
fields
[
'email'
].
label
=
_
(
'Email address'
)
self
.
fields
[
'password1'
].
label
=
_
(
'Password'
)
self
.
fields
[
'password2'
].
label
=
_
(
'Password (again)'
)
def
save
(
self
,
*
args
,
**
kwargs
):
new_user
=
super
(
RegistrationForm
,
self
).
save
(
*
args
,
**
kwargs
)
new_user
.
first_name
=
self
.
cleaned_data
[
'first_name'
]
new_user
.
last_name
=
self
.
cleaned_data
[
'last_name'
]
new_user
.
save
()
return
new_user
html/registration/registration_form.html
View file @
71be3bf3
...
...
@@ -16,36 +16,10 @@
<form
action=
"{% url 'registration.views.register' %}"
method=
"post"
accept-charset=
"utf-8"
>
{% csrf_token %}
<fieldset>
<legend>
{% trans "User registration" %}
</legend>
<label
for=
"id_username"
>
{% trans "Username" %}
</label>
<p>
{{ form.username }}
{% if form.username.errors %}
<br
/><span
class=
"ui-state-error"
>
* {{ form.username.errors|join:"; " }}
</span>
{% endif %}
</p>
<label
for=
"id_email"
>
{% trans "E-mail" %} {% trans "(will be used as Git author)" %}
</label>
<p>
{{ form.email }}
{% if form.email.errors %}
<br
/><span
class=
"ui-state-error"
>
* {{ form.email.errors|join:"; " }}
</span>
{% endif %}
</p>
<label
for=
"id_password1"
>
{% trans "Password" %}
</label>
<p>
{{ form.password1 }}
{% if form.password1.errors %}
<br
/><span
class=
"ui-state-error"
>
* {{ form.password1.errors|join:"; " }}
</span>
{% endif %}
</p>
<label
for=
"id_password2"
>
{% trans "Password (again)" %}
</label>
<p>
{{ form.password2 }}
{% if form.password2.errors %}
<br
/><span
class=
"ui-state-error"
>
* {{ form.password2.errors|join:"; " }}
</span>
{% endif %}
</p>
{% if form.non_field_errors %}
<ul
class=
"ui-state-error"
>
{{ form.non_field_errors.as_ul }}
</ul>
{% endif %}
</fieldset>
<table>
{{ form.as_table }}
</table>
<p>
{% trans "By registering you agree to use your name and email in Git commits." %}
</p>
<p><input
type=
"submit"
value=
"{% trans 'Register' %}"
/></p>
</form>
...
...
urls.py
View file @
71be3bf3
from
django.conf.urls.defaults
import
patterns
,
include
,
url
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.contrib
import
admin
from
accounts.forms
import
RegistrationForm
...
...
@@ -22,7 +23,7 @@ urlpatterns = patterns('',
# Auth
url
(
r'^accounts/'
,
include
(
'registration.urls'
)),
url
(
r'^accoints/register/$'
,
'registration.views.register'
,
{
'form_class'
:
RegistrationForm
},
name
=
'registration_register'
),
url
(
r'^accoints/register/$'
,
'registration.views.register'
,
{
'form_class'
:
RegistrationForm
,
'extra_context'
:
{
'title'
:
_
(
'User registration'
)}
},
name
=
'registration_register'
),
url
(
r'^accounts/profile/'
,
'accounts.views.profile'
),
url
(
r'^contact/'
,
'accounts.views.contact'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment