Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
420564e7
Commit
420564e7
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
GREG-113: Handle date of birth. Some cleanup
parent
e2907822
No related branches found
No related tags found
1 merge request
!166
GREG-113 guest date of birth
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gregui/api/views/invitation.py
+11
-18
11 additions, 18 deletions
gregui/api/views/invitation.py
with
11 additions
and
18 deletions
gregui/api/views/invitation.py
+
11
−
18
View file @
420564e7
...
...
@@ -72,8 +72,8 @@ class InvitationView(CreateAPIView, DestroyAPIView):
person
=
serializer
.
save
()
for
invitationlink
in
InvitationLink
.
objects
.
filter
(
invitation__role__person_id
=
person
.
id
,
invitation__role__sponsor_id
=
sponsor_user
.
sponsor_id
,
invitation__role__person_id
=
person
.
id
,
invitation__role__sponsor_id
=
sponsor_user
.
sponsor_id
,
):
send_invite_mail
(
invitationlink
)
...
...
@@ -183,23 +183,16 @@ class InvitedGuestView(GenericAPIView):
else
SessionType
.
FEIDE
.
value
)
fnr
=
self
.
_get_identity_or_none
(
person
,
Identity
.
IdentityType
.
NORWEGIAN_NATIONAL_ID_NUMBER
)
passport
=
self
.
_get_identity_or_none
(
person
,
Identity
.
IdentityType
.
PASSPORT_NUMBER
)
feide_id
=
self
.
_get_identity_or_none
(
person
,
Identity
.
IdentityType
.
FEIDE_ID
)
data
=
{
"
person
"
:
{
"
first_name
"
:
person
.
first_name
,
"
last_name
"
:
person
.
last_name
,
"
email
"
:
person
.
private_email
and
person
.
private_email
.
value
,
"
mobile_phone
"
:
person
.
private_mobile
and
person
.
private_mobile
.
value
,
"
fnr
"
:
fnr
,
"
passport
"
:
passport
,
"
feide_id
"
:
feide_id
,
"
date_of_birth
"
:
person
.
date_of_birth
,
"
fnr
"
:
person
.
fnr
and
person
.
fnr
.
value
,
"
passport
"
:
person
.
passport
and
person
.
passport
.
value
,
"
feide_id
"
:
person
.
feide_id
and
person
.
feide_id
.
value
,
},
"
sponsor
"
:
{
"
first_name
"
:
sponsor
.
first_name
,
...
...
@@ -243,10 +236,10 @@ class InvitedGuestView(GenericAPIView):
# If there is a Feide ID registered with the guest, assume that the name is also coming from there
feide_id
=
self
.
_get_identity_or_none
(
person
,
Identity
.
IdentityType
.
FEIDE_ID
)
if
not
self
.
_only_allowed_fields_in_request
(
data
,
self
.
fields_allowed_to_update_if_invite
if
feide_id
is
None
else
self
.
fields_allowed_to_update_if_feide
,
data
,
self
.
fields_allowed_to_update_if_invite
if
feide_id
is
None
else
self
.
fields_allowed_to_update_if_feide
,
):
return
Response
(
status
=
status
.
HTTP_400_BAD_REQUEST
)
...
...
@@ -296,7 +289,7 @@ class InvitedGuestView(GenericAPIView):
@staticmethod
def
_get_identity_or_none
(
person
:
Person
,
identity_type
:
Identity
.
IdentityType
person
:
Person
,
identity_type
:
Identity
.
IdentityType
)
->
Optional
[
str
]:
try
:
return
person
.
identities
.
get
(
type
=
identity_type
).
value
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment