Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Hjelp
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
Model registry
Operate
Environments
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
AlekSIS®
Official
AlekSIS-App-Hjelp
Commits
1456fbfe
Commit
1456fbfe
authored
4 years ago
by
Hangzhi Yu
Browse files
Options
Downloads
Patches
Plain Diff
Change method to get from email
parent
6a054908
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!25
Resolve "Fix send email"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/hjelp/views.py
+10
-3
10 additions, 3 deletions
aleksis/apps/hjelp/views.py
with
10 additions
and
3 deletions
aleksis/apps/hjelp/views.py
+
10
−
3
View file @
1456fbfe
from
django.conf
import
settings
from
django.http
import
JsonResponse
from
django.shortcuts
import
render
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -12,6 +13,12 @@ from .forms import FAQForm, FeedbackForm, IssueForm
from
.models
import
FAQQuestion
,
FAQSection
,
IssueCategory
def
get_from_email
(
request
):
if
request
.
user
.
email
:
return
f
"
{
request
.
user
.
get_full_name
()
}
<
{
request
.
user
.
email
}
>
"
return
settings
.
DEFAULT_FROM_EMAIL
@permission_required
(
"
hjelp.view_faq
"
)
def
faq
(
request
):
"""
Show the FAQ page.
"""
...
...
@@ -45,7 +52,7 @@ def ask_faq(request):
}
send_templated_mail
(
template_name
=
"
hjelp
"
,
from_email
=
f
"
{
request
.
user
.
get_full_name
()
}
<
{
request
.
user
.
email
}
>
"
,
from_email
=
get_from_email
(
request
)
,
recipient_list
=
[
get_site_preferences
()[
"
hjelp__faq_recipient
"
]],
context
=
context
,
)
...
...
@@ -112,7 +119,7 @@ def report_issue(request):
}
send_templated_mail
(
template_name
=
"
hjelp
"
,
from_email
=
f
"
{
request
.
user
.
get_full_name
()
}
<
{
request
.
user
.
email
}
>
"
,
from_email
=
get_from_email
(
request
)
,
recipient_list
=
[
get_site_preferences
()[
"
hjelp__issue_report_recipient
"
]],
context
=
context
,
)
...
...
@@ -162,7 +169,7 @@ def feedback(request):
}
send_templated_mail
(
template_name
=
"
hjelp
"
,
from_email
=
f
"
{
request
.
user
.
get_full_name
()
}
<
{
request
.
user
.
email
}
>
"
,
from_email
=
get_from_email
(
request
)
,
recipient_list
=
[
get_site_preferences
()[
"
hjelp__feedback_recipient
"
]],
context
=
context
,
)
...
...
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