Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
787ceab5
Commit
787ceab5
authored
Aug 11, 2018
by
Benjamin Graillot
Committed by
Hugo LEVY-FALK
Aug 14, 2018
Browse files
[Adherent] Ajout gpg_fingerprint
parent
95df4eef
Changes
4
Hide whitespace changes
Inline
Side-by-side
users/forms.py
View file @
787ceab5
...
...
@@ -301,6 +301,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
super
(
AdherentForm
,
self
).
__init__
(
*
args
,
prefix
=
prefix
,
**
kwargs
)
self
.
fields
[
'name'
].
label
=
'Prénom'
self
.
fields
[
'surname'
].
label
=
'Nom'
self
.
fields
[
'email'
].
label
=
'Adresse mail'
self
.
fields
[
'school'
].
label
=
'Établissement'
self
.
fields
[
'comment'
].
label
=
'Commentaire'
self
.
fields
[
'room'
].
label
=
'Chambre'
...
...
@@ -319,6 +320,7 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
'room'
,
'shell'
,
'telephone'
,
'gpg_fingerprint'
]
def
clean_telephone
(
self
):
...
...
@@ -331,6 +333,12 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
)
return
telephone
def
clean_gpg_fingerprint
(
self
):
"""Format the GPG fingerprint"""
gpg_fingerprint
=
self
.
cleaned_data
.
get
(
'gpg_fingerprint'
,
None
)
if
gpg_fingerprint
:
return
gpg_fingerprint
.
replace
(
' '
,
''
).
upper
()
force
=
forms
.
BooleanField
(
label
=
"Forcer le déménagement ?"
,
initial
=
False
,
...
...
users/migrations/0074_auto_20180810_2104.py
0 → 100644
View file @
787ceab5
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-10 19:04
from
__future__
import
unicode_literals
import
django.core.validators
from
django.db
import
migrations
,
models
import
users.models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0073_auto_20180629_1614'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'adherent'
,
name
=
'gpg_fingerprint'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
40
,
null
=
True
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
'^[0-9A-F]{40}$'
,
message
=
'Une fingerprint GPG doit contenit 40 caractères hexadécimaux'
)]),
),
]
users/migrations/0075_auto_20180811_0420.py
0 → 100644
View file @
787ceab5
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-11 02:20
from
__future__
import
unicode_literals
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0074_auto_20180810_2104'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'adherent'
,
name
=
'gpg_fingerprint'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
40
,
null
=
True
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
'^[0-9A-F]{40}$'
,
message
=
'Une fingerprint GPG doit contenir 40 caractères hexadécimaux'
)]),
),
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'email'
,
field
=
models
.
EmailField
(
max_length
=
254
,
unique
=
True
),
),
]
users/models.py
View file @
787ceab5
...
...
@@ -985,6 +985,16 @@ class Adherent(User):
blank
=
True
,
null
=
True
)
gpg_fingerprint
=
models
.
CharField
(
max_length
=
40
,
blank
=
True
,
null
=
True
,
validators
=
[
RegexValidator
(
'^[0-9A-F]{40}$'
,
message
=
"Une fingerprint GPG doit contenir 40 "
"caractères hexadécimaux"
)]
)
@
classmethod
def
get_instance
(
cls
,
adherentid
,
*
_args
,
**
_kwargs
):
...
...
Write
Preview
Supports
Markdown
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