Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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
AlekSIS®
Official
AlekSIS-Core
Commits
8c16cf4c
Verified
Commit
8c16cf4c
authored
2 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Introduce a UUID for every object
parent
94d2c56d
Branches
627-missing-permission-for-user-invitations
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1047
Draft: Resolve "[3.0] Introduce Graphene/GraphQL"
,
!1045
Introduce Vuetify and GraphQL
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+12
-0
12 additions, 0 deletions
CHANGELOG.rst
aleksis/core/migrations/0042_add_uuid_field.py
+95
-0
95 additions, 0 deletions
aleksis/core/migrations/0042_add_uuid_field.py
aleksis/core/mixins.py
+7
-0
7 additions, 0 deletions
aleksis/core/mixins.py
with
114 additions
and
0 deletions
CHANGELOG.rst
+
12
−
0
View file @
8c16cf4c
...
...
@@ -9,6 +9,18 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Deprecated
~~~~~~~~~~
* Numeric object IDs (primary keys) will be removed and replaced by UUIDs in
AlekSIS-Core 4.0. All apps must update their URLs, foriegn keys and the
like.
Added
~~~~~
* Introduce a UUID for every object
`2.10`_ - 2022-06-25
--------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/migrations/0042_add_uuid_field.py
0 → 100644
+
95
−
0
View file @
8c16cf4c
# Generated by Django 3.2.14 on 2022-07-16 12:49
import
aleksis.core.mixins
from
django.db
import
migrations
,
models
import
django.utils.timezone
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
core
'
,
'
0041_update_gender_choices
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
activity
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
additionalfield
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
announcement
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
announcementrecipient
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
custommenu
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
custommenuitem
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
dashboardwidgetorder
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
datacheckresult
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
group
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
grouptype
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
notification
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
pdffile
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
person
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
persongroupthrough
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
schoolterm
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
migrations
.
AddField
(
model_name
=
'
taskuserassignment
'
,
name
=
'
uuid
'
,
field
=
models
.
UUIDField
(
default
=
aleksis
.
core
.
mixins
.
_generate_object_uuid
,
editable
=
False
,
unique
=
True
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/core/mixins.py
+
7
−
0
View file @
8c16cf4c
# flake8: noqa: DJ12
import
os
import
uuid
from
datetime
import
datetime
from
typing
import
Any
,
Callable
,
List
,
Optional
,
Union
...
...
@@ -82,6 +83,10 @@ def _generate_one_to_one_proxy_property(field, subfield):
return
property
(
getter
,
setter
)
def
_generate_object_uuid
():
return
uuid
.
uuid5
(
uuid
.
NAMESPACE_URL
,
settings
.
BASE_URL
)
class
ExtensibleModel
(
models
.
Model
,
metaclass
=
_ExtensibleModelBase
):
"""
Base model for all objects in AlekSIS apps.
...
...
@@ -126,6 +131,8 @@ class ExtensibleModel(models.Model, metaclass=_ExtensibleModelBase):
- Dominik George <dominik.george@teckids.org>
"""
uuid
=
models
.
UUIDField
(
unique
=
True
,
default
=
_generate_object_uuid
,
editable
=
False
)
# Defines a material design icon associated with this type of model
icon_
=
"
radio_button_unchecked
"
...
...
This diff is collapsed.
Click to expand it.
Nik | Klampfradler
@nik
mentioned in commit
8716b18d
·
2 years ago
mentioned in commit
8716b18d
mentioned in commit 8716b18dd8d7cff79aa081256f4442afa5e62130
Toggle commit list
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