Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Abi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Show more breadcrumbs
magicfelix
AlekSIS-App-Abi
Commits
0064369d
Verified
Commit
0064369d
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add option to upload additional pictures and fix progress calculation
parent
23fb4ad9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/abi/migrations/0014_pictures.py
+35
-0
35 additions, 0 deletions
aleksis/apps/abi/migrations/0014_pictures.py
aleksis/apps/abi/models.py
+12
-2
12 additions, 2 deletions
aleksis/apps/abi/models.py
with
47 additions
and
2 deletions
aleksis/apps/abi/migrations/0014_pictures.py
0 → 100644
+
35
−
0
View file @
0064369d
# Generated by Django 3.2.9 on 2021-11-19 17:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
abi
'
,
'
0013_comment
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
profile
'
,
name
=
'
additional_picture_1
'
,
field
=
models
.
ImageField
(
blank
=
True
,
upload_to
=
'
abi/additional1/
'
,
verbose_name
=
'
Additional picture 1
'
),
),
migrations
.
AddField
(
model_name
=
'
profile
'
,
name
=
'
additional_picture_2
'
,
field
=
models
.
ImageField
(
blank
=
True
,
upload_to
=
'
abi/additional2/
'
,
verbose_name
=
'
Additional picture 2
'
),
),
migrations
.
AlterField
(
model_name
=
'
profile
'
,
name
=
'
current_picture
'
,
field
=
models
.
ImageField
(
blank
=
True
,
default
=
''
,
upload_to
=
'
abi/current/
'
,
verbose_name
=
'
Current picture
'
),
preserve_default
=
False
,
),
migrations
.
AlterField
(
model_name
=
'
profile
'
,
name
=
'
old_picture
'
,
field
=
models
.
ImageField
(
blank
=
True
,
default
=
''
,
upload_to
=
'
abi/old/
'
,
verbose_name
=
'
Picture from the childhood
'
),
preserve_default
=
False
,
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/abi/models.py
+
12
−
2
View file @
0064369d
...
...
@@ -86,6 +86,10 @@ class AbiPerson(ExtensibleModel):
pictures
.
append
(
_
(
"
Current picture
"
))
if
self
.
profile
.
old_picture
:
pictures
.
append
(
_
(
"
Old picture
"
))
if
self
.
profile
.
additional_picture_1
:
pictures
.
append
(
_
(
"
Additional picture 1
"
))
if
self
.
profile
.
additional_picture_2
:
pictures
.
append
(
_
(
"
Additional picture 2
"
))
return
pictures
class
Meta
:
...
...
@@ -136,14 +140,20 @@ class Profile(ExtensibleModel):
old_picture
=
models
.
ImageField
(
blank
=
True
,
upload_to
=
"
abi/old/
"
,
verbose_name
=
_
(
"
Picture from the childhood
"
)
)
additional_picture_1
=
models
.
ImageField
(
blank
=
True
,
upload_to
=
"
abi/additional1/
"
,
verbose_name
=
_
(
"
Additional picture 1
"
)
)
additional_picture_2
=
models
.
ImageField
(
blank
=
True
,
upload_to
=
"
abi/additional2/
"
,
verbose_name
=
_
(
"
Additional picture 2
"
)
)
@property
def
progress_of_own_fields
(
self
):
return
len
(
list
(
filter
(
bool
,
[
self
.
nickname
,
self
.
current_picture
,
self
.
old_picture
])))
return
len
(
list
(
filter
(
bool
,
[
self
.
nickname
])))
@classmethod
def
get_number_of_own_fields
(
cls
):
return
3
return
1
def
__str__
(
self
):
return
str
(
self
.
person
)
...
...
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