Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Paweljong
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
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
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
Teckids
Projekt Hack-n-Fun
AlekSIS-App-Paweljong
Commits
4ca65f10
Verified
Commit
4ca65f10
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Implement automatic sending of info mailings
parent
d24d07e1
No related branches found
No related tags found
1 merge request
!9
Resolve "Info mailing"
Pipeline
#56918
failed
3 years ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/paweljong/models.py
+6
-0
6 additions, 0 deletions
aleksis/apps/paweljong/models.py
aleksis/apps/paweljong/tasks.py
+10
-0
10 additions, 0 deletions
aleksis/apps/paweljong/tasks.py
with
16 additions
and
0 deletions
aleksis/apps/paweljong/models.py
+
6
−
0
View file @
4ca65f10
...
@@ -29,6 +29,8 @@ class InfoMailing(ExtensibleModel):
...
@@ -29,6 +29,8 @@ class InfoMailing(ExtensibleModel):
text
=
RichTextField
(
verbose_name
=
_
(
"
Text
"
))
text
=
RichTextField
(
verbose_name
=
_
(
"
Text
"
))
reply_to
=
models
.
EmailField
(
verbose_name
=
_
(
"
Request replies to
"
),
blank
=
True
)
reply_to
=
models
.
EmailField
(
verbose_name
=
_
(
"
Request replies to
"
),
blank
=
True
)
active
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Mailing is active
"
),
default
=
False
)
send_to_person
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Send to registered person
"
),
default
=
True
)
send_to_person
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Send to registered person
"
),
default
=
True
)
send_to_guardians
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Send to guardians
"
),
default
=
False
)
send_to_guardians
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Send to guardians
"
),
default
=
False
)
...
@@ -37,6 +39,10 @@ class InfoMailing(ExtensibleModel):
...
@@ -37,6 +39,10 @@ class InfoMailing(ExtensibleModel):
def
__str__
(
self
)
->
str
:
def
__str__
(
self
)
->
str
:
return
self
.
subject
return
self
.
subject
@classmethod
def
get_active_mailings
(
cls
):
return
cls
.
objects
.
filter
(
active
=
True
)
def
send
(
self
):
def
send
(
self
):
sent_to
=
self
.
sent_to
.
all
()
sent_to
=
self
.
sent_to
.
all
()
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/paweljong/tasks.py
0 → 100644
+
10
−
0
View file @
4ca65f10
from
datetime
import
timedelta
from
aleksis.core.celery
import
app
@app.task
(
run_every
=
timedelta
(
hours
=
1
))
def
send_info_mailings
()
->
None
:
from
.models
import
InfoMailing
# noqa
for
mailing
in
InfoMailing
.
get_active_mailings
():
mailing
.
send
()
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