SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit f625077b authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add email this profile button

fixes #313
parent f8bf1f2a
No related branches found
No related tags found
No related merge requests found
......@@ -210,6 +210,7 @@
</div>
<div class="card-body">
<ul>
<li><a href="{% url 'profiles:profile_send_email' pk=profile.id %}">Send an email</a> to this Profile</li>
<li><a href="{% url 'profiles:profile_update' pk=profile.id %}">Update</a> this Profile</li>
<li><a href="{% url 'profiles:profile_delete' pk=profile.id %}" class="text-danger">Delete</a> this Profile</li>
</ul>
......
......@@ -46,6 +46,11 @@ urlpatterns = [
"<int:pk>/",
include(
[
path(
"send_email/",
views.ProfileSendEmailView.as_view(),
name="profile_send_email",
),
path(
"update/", views.ProfileUpdateView.as_view(), name="profile_update"
),
......
......@@ -17,6 +17,7 @@ from django.views.generic.list import ListView
from dal import autocomplete
from guardian.decorators import permission_required
from mails.views import MailView
from profiles import constants
from scipost.mixins import PermissionsMixin, PaginationMixin
......@@ -634,3 +635,14 @@ class AffiliationDeleteView(UserPassesTestMixin, DeleteView):
"profiles:profile_detail", kwargs={"pk": self.object.profile.id}
)
return reverse_lazy("scipost:personal_page")
class ProfileSendEmailView(PermissionsMixin, MailView):
"""Send a custom email to the profile."""
permission_required = "scipost.can_email_profiles"
queryset = Profile.objects.all()
mail_code = "profiles/profile_send_mail"
def get_success_url(self):
return self.object.get_absolute_url()
......@@ -172,6 +172,11 @@ class Command(BaseCommand):
name="Can email particulars",
content_type=content_type,
)
can_email_profiles, created = Permission.objects.get_or_create(
codename="can_email_profiles",
name="Can email profiles",
content_type=content_type,
)
# Editorial College
can_manage_college_composition, created = Permission.objects.get_or_create(
......@@ -518,6 +523,7 @@ class Command(BaseCommand):
can_create_registration_invitations,
can_email_group_members,
can_email_particulars,
can_email_profiles,
can_resend_registration_requests,
can_vet_registration_requests,
can_vet_commentary_requests,
......@@ -588,6 +594,7 @@ class Command(BaseCommand):
[
can_view_pool,
can_invite_fellows,
can_email_profiles,
can_assign_submissions,
can_do_plagiarism_checks,
can_oversee_refereeing,
......
<p>Dear {{ object.get_title_display }} {{ object.last_name }},</p>
<p>[CONTENT]</p>
{% include 'email/_footer.html' %}
{
"subject": "SciPost: ",
"recipient_list": [
"emails|values_list:email"
],
"bcc": [
"edadmin@"
],
"from_name": "SciPost EdAdmin",
"from_email": "edadmin@"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment