Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
e95e7534
Commit
e95e7534
authored
Aug 29, 2015
by
Enrico Zini
Browse files
Replaced old Person.fpr field with a property that queries the Fingerprint model
parent
8249b9de
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/migrations/0004_remove_person_fpr.py
0 → 100644
View file @
e95e7534
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0003_auto_20150829_0905'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'person'
,
name
=
'fpr'
,
),
]
backend/models.py
View file @
e95e7534
...
...
@@ -485,8 +485,6 @@ class Person(PermissionsMixin, models.Model):
help_text
=
"Please enter here a short biographical information"
)
# This is null for people who still have not picked one
uid
=
CharNullField
(
"Debian account name"
,
max_length
=
32
,
null
=
True
,
unique
=
True
,
blank
=
True
)
# OpenPGP fingerprint, NULL until one has been provided
fpr
=
FingerprintField
(
"OpenPGP key fingerprint"
,
max_length
=
40
,
null
=
True
,
unique
=
True
,
blank
=
True
)
# Membership status
status
=
models
.
CharField
(
"current status in the project"
,
max_length
=
20
,
null
=
False
,
...
...
@@ -530,6 +528,17 @@ class Person(PermissionsMixin, models.Model):
def
has_usable_password
(
self
):
return
False
@
property
def
fpr
(
self
):
"""
Return the current fingerprint for this Person
"""
# TODO: add a way to tell the current valid fingerprints from
# old/revoked ones
for
f
in
self
.
fprs
.
all
():
return
f
.
fpr
return
None
USERNAME_FIELD
=
'username'
REQUIRED_FIELDS
=
[
"cn"
,
"email"
,
"status"
]
...
...
public/views.py
View file @
e95e7534
...
...
@@ -789,13 +789,10 @@ YESNO = (
)
class
NewPersonForm
(
forms
.
ModelForm
):
fpr
=
forms
.
CharField
(
label
=
"Fingerprint"
,
min_length
=
40
,
widget
=
forms
.
TextInput
(
attrs
=
{
"size"
:
60
}))
sc_ok
=
forms
.
ChoiceField
(
choices
=
YESNO
,
widget
=
forms
.
RadioSelect
(),
label
=
"SC and DFSG agreement"
)
dmup_ok
=
forms
.
ChoiceField
(
choices
=
YESNO
,
widget
=
forms
.
RadioSelect
(),
label
=
"DMUP agreement"
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
NewPersonForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
"fpr"
].
required
=
True
def
clean_fpr
(
self
):
return
bmodels
.
FingerprintField
.
clean_fingerprint
(
self
.
cleaned_data
[
'fpr'
])
...
...
@@ -813,9 +810,8 @@ class NewPersonForm(forms.ModelForm):
class
Meta
:
model
=
bmodels
.
Person
fields
=
[
"cn"
,
"mn"
,
"sn"
,
"email"
,
"bio"
,
"uid"
,
"fpr"
]
fields
=
[
"cn"
,
"mn"
,
"sn"
,
"email"
,
"bio"
,
"uid"
]
widgets
=
{
"fpr"
:
forms
.
TextInput
(
attrs
=
{
'size'
:
60
}),
"bio"
:
forms
.
Textarea
(
attrs
=
{
'cols'
:
80
,
'rows'
:
25
}),
}
...
...
restricted/views.py
View file @
e95e7534
...
...
@@ -188,7 +188,7 @@ class Person(VisitPersonTemplateView):
# Build the form to edit the person
includes
=
[]
if
"edit_ldap"
in
perms
:
includes
.
extend
((
"cn"
,
"mn"
,
"sn"
,
"email"
,
"uid"
,
"fpr"
))
includes
.
extend
((
"cn"
,
"mn"
,
"sn"
,
"email"
,
"uid"
))
if
self
.
visitor
.
is_admin
:
includes
.
extend
((
"status"
,
"fd_comment"
,
"expires"
,
"pending"
))
if
"edit_bio"
in
perms
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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