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
4ea099a7
Commit
4ea099a7
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
Fixing formatting
parent
33ebdd87
No related branches found
No related tags found
1 merge request
!166
GREG-113 guest date of birth
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
greg/models.py
+13
-15
13 additions, 15 deletions
greg/models.py
gregui/api/serializers/guest.py
+2
-2
2 additions, 2 deletions
gregui/api/serializers/guest.py
gregui/api/views/invitation.py
+7
-7
7 additions, 7 deletions
gregui/api/views/invitation.py
with
22 additions
and
24 deletions
greg/models.py
+
13
−
15
View file @
4ea099a7
...
...
@@ -93,10 +93,8 @@ class Person(BaseModel):
@property
def
feide_id
(
self
)
->
Optional
[
"
Identity
"
]:
"""
The person
'
s Feide ID if they have one registered.
"""
return
self
.
identities
.
filter
(
type
=
Identity
.
IdentityType
.
FEIDE_ID
).
first
()
"""
The person
'
s Feide ID if they have one registered.
"""
return
self
.
identities
.
filter
(
type
=
Identity
.
IdentityType
.
FEIDE_ID
).
first
()
@property
def
is_registered
(
self
)
->
bool
:
...
...
@@ -118,8 +116,8 @@ class Person(BaseModel):
"""
# registration_completed_date is set only after accepting consents
return
(
self
.
registration_completed_date
is
not
None
and
self
.
registration_completed_date
<=
date
.
today
()
self
.
registration_completed_date
is
not
None
and
self
.
registration_completed_date
<=
date
.
today
()
)
@staticmethod
...
...
@@ -160,15 +158,15 @@ class Person(BaseModel):
authenticity, or trust level of the guest
'
s associated identities.
"""
return
(
self
.
identities
.
filter
(
type__in
=
[
Identity
.
IdentityType
.
NORWEGIAN_NATIONAL_ID_NUMBER
,
Identity
.
IdentityType
.
PASSPORT_NUMBER
,
],
verified_at__isnull
=
False
,
verified_at__lte
=
timezone
.
now
(),
).
count
()
>=
1
self
.
identities
.
filter
(
type__in
=
[
Identity
.
IdentityType
.
NORWEGIAN_NATIONAL_ID_NUMBER
,
Identity
.
IdentityType
.
PASSPORT_NUMBER
,
],
verified_at__isnull
=
False
,
verified_at__lte
=
timezone
.
now
(),
).
count
()
>=
1
)
@property
...
...
This diff is collapsed.
Click to expand it.
gregui/api/serializers/guest.py
+
2
−
2
View file @
4ea099a7
...
...
@@ -67,8 +67,8 @@ class GuestRegisterSerializer(serializers.ModelSerializer):
# Check that the date of birth is between the interval starting about 100 years ago and last year
if
(
not
today
-
datetime
.
timedelta
(
weeks
=
100
*
52
)
<
date_of_birth
<
today
-
datetime
.
timedelta
(
weeks
=
52
)
<
date_of_birth
<
today
-
datetime
.
timedelta
(
weeks
=
52
)
):
raise
serializers
.
ValidationError
(
"
Invalid date of birth
"
)
...
...
This diff is collapsed.
Click to expand it.
gregui/api/views/invitation.py
+
7
−
7
View file @
4ea099a7
...
...
@@ -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
)
...
...
@@ -236,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
)
...
...
@@ -289,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