Commit 662c1637 authored by dennisjl's avatar dennisjl
Browse files

Merge branch 'refactoring' of https://gitlab.stud.idi.ntnu.no/j/agreelance into refactoring

parents 6fe3ff05 2d3deff4
Pipeline #79936 passed with stage
in 1 minute and 16 seconds
#!/usr/bin/env bash
sonar-scanner \
-Dsonar.projectKey=agreelance \
-Dsonar.sources=. \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=767973fda0b0e64e4ce76a2200e982b4aadee2fb
......@@ -32,18 +32,7 @@ def new_project(request):
project.save()
people = Profile.objects.filter(categories__id=project.category.id)
from django.core import mail
for person in people:
if person.user.email:
try:
with mail.get_connection() as connection:
mail.EmailMessage(
"New Project: " + project.title , "A new project you might be interested in was created and can be viwed at " + current_site.domain + '/projects/' + str(project.id), "Agreelancer", [person.user.email],
connection=connection,
).send()
except Exception as e:
from django.contrib import messages
messages.success(request, 'Sending of email to ' + person.user.email + " failed: " + str(e))
send_project_email(people, project, request, current_site)
task_title = request.POST.getlist('task_title')
task_description = request.POST.getlist('task_description')
......@@ -60,6 +49,20 @@ def new_project(request):
form = ProjectForm()
return render(request, 'projects/new_project.html', {'form': form})
def send_project_email(people, project, request, current_site):
from django.core import mail
for person in people:
if person.user.email:
try:
with mail.get_connection() as connection:
mail.EmailMessage(
"New Project: " + project.title , "A new project you might be interested in was created and can be viwed at " + current_site.domain + '/projects/' + str(project.id), "Agreelancer", [person.user.email],
connection=connection,
).send()
except Exception as e:
from django.contrib import messages
messages.success(request, 'Sending of email to ' + person.user.email + " failed: " + str(e))
def project_view(request, project_id):
project = Project.objects.get(pk=project_id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment