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
230d989e
Commit
230d989e
authored
3 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Assign calendar urls to users using a new model
parent
6021f09c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!975
Resolve "Add possibility to create Ical feeds for all apps"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/migrations/0039_personal_ical_url.py
+31
-0
31 additions, 0 deletions
aleksis/core/migrations/0039_personal_ical_url.py
aleksis/core/models.py
+34
-0
34 additions, 0 deletions
aleksis/core/models.py
with
65 additions
and
0 deletions
aleksis/core/migrations/0039_personal_ical_url.py
0 → 100644
+
31
−
0
View file @
230d989e
# Generated by Django 3.2.12 on 2022-02-20 21:04
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
uuid
from
aleksis.core.feeds
import
PersonalICalFeedBase
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
core
'
,
'
0038_notification_send_at
'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'
PersonalICalUrl
'
,
fields
=
[
(
'
id
'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'
ID
'
)),
(
'
uuid
'
,
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
unique
=
True
,
verbose_name
=
'
UUID
'
)),
(
'
name
'
,
models
.
CharField
(
max_length
=
255
,
verbose_name
=
'
Name
'
)),
(
'
ical_feed
'
,
models
.
CharField
(
choices
=
PersonalICalFeedBase
.
subclass_choices
,
max_length
=
255
,
verbose_name
=
'
Selected ICal feed
'
)),
(
'
person
'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'
calendar_urls
'
,
to
=
'
core.person
'
,
verbose_name
=
'
Person
'
)),
],
options
=
{
'
verbose_name
'
:
'
Personal Calendar URL
'
,
'
verbose_name_plural
'
:
'
Personal Calendar URLs
'
,
},
),
]
This diff is collapsed.
Click to expand it.
aleksis/core/models.py
+
34
−
0
View file @
230d989e
...
...
@@ -4,6 +4,7 @@ import hmac
from
datetime
import
date
,
datetime
,
timedelta
from
typing
import
Any
,
Iterable
,
List
,
Optional
,
Sequence
,
Union
from
urllib.parse
import
urlparse
import
uuid
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
...
...
@@ -51,6 +52,7 @@ from phonenumber_field.modelfields import PhoneNumberField
from
polymorphic.models
import
PolymorphicModel
from
aleksis.core.data_checks
import
BrokenDashboardWidgetDataCheck
,
DataCheck
,
DataCheckRegistry
from
.feeds
import
PersonalICalFeedBase
from
.managers
import
(
CurrentSiteManagerWithoutMigrations
,
...
...
@@ -1351,3 +1353,35 @@ class OAuthRefreshToken(AbstractRefreshToken):
"""
Placeholder for customising the RefreshToken model.
"""
pass
class
PersonalICalUrl
(
models
.
Model
):
"""
Calendar URL for a person
"""
person
=
models
.
ForeignKey
(
"
Person
"
,
on_delete
=
models
.
CASCADE
,
related_name
=
"
calendar_urls
"
,
verbose_name
=
_
(
"
Person
"
),
)
uuid
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
editable
=
False
,
verbose_name
=
_
(
"
UUID
"
),
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
255
,
verbose_name
=
_
(
"
Name
"
))
ical_feed
=
models
.
CharField
(
max_length
=
255
,
verbose_name
=
_
(
"
Selected ICal feed
"
),
choices
=
PersonalICalFeedBase
.
subclass_choices
,
)
@property
def
ical_feed_object
(
self
):
return
PersonalICalFeedBase
.
subclasses_dict
.
get
(
self
.
ical_feed
)
class
Meta
:
verbose_name
=
_
(
"
Personal Calendar URL
"
)
verbose_name_plural
=
_
(
"
Personal Calendar URLs
"
)
def
__str__
(
self
):
return
self
.
name
def
get_absolute_url
(
self
):
return
reverse
(
"
ical_feed
"
,
kwargs
=
{
"
slug
"
:
self
.
uuid
})
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