add responsible_team to most emails, while here run pre-commit run --all-files
This commit is contained in:
parent
a789569fdc
commit
bd53f64208
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from utils.models import CampRelatedModel
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.views.generic import ListView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from django.views.generic import ListView
|
||||
|
||||
from .models import ProductCategory
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from django.conf.urls import url
|
||||
|
||||
from program.consumers import ScheduleConsumer
|
||||
|
||||
application = ProtocolTypeRouter(
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from camps.models import Camp
|
||||
from graphene import ObjectType, Schema, relay
|
||||
from graphene_django import DjangoObjectType
|
||||
from graphene_django.filter import DjangoFilterConnectionField
|
||||
|
||||
from camps.models import Camp
|
||||
from program.schema import ProgramQuery
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from camps.models import Camp
|
||||
from django.contrib import admin
|
||||
from django.utils import timezone
|
||||
|
||||
from camps.models import Camp
|
||||
|
||||
|
||||
def get_current_camp():
|
||||
try:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from teams.models import Team
|
||||
from utils.email import add_outgoing_email
|
||||
|
||||
# expense emails
|
||||
|
@ -12,8 +12,10 @@ def send_accountingsystem_expense_email(expense):
|
|||
Sends an email to the accountingsystem with the invoice as an attachment,
|
||||
and with the expense uuid and description in email subject
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=expense.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/accountingsystem_expense_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/accountingsystem_expense_email.txt",
|
||||
formatdict=dict(expense=expense),
|
||||
subject="Expense %s for %s" % (expense.pk, expense.camp.title),
|
||||
to_recipients=[settings.ACCOUNTINGSYSTEM_EMAIL],
|
||||
|
@ -26,8 +28,10 @@ def send_expense_approved_email(expense):
|
|||
"""
|
||||
Sends an expense-approved email to the user who created the expense
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=expense.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/expense_approved_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/expense_approved_email.txt",
|
||||
formatdict=dict(expense=expense),
|
||||
subject="Your expense for %s has been approved." % expense.camp.title,
|
||||
to_recipients=[expense.user.emailaddress_set.get(primary=True).email],
|
||||
|
@ -38,8 +42,10 @@ def send_expense_rejected_email(expense):
|
|||
"""
|
||||
Sends an expense-rejected email to the user who created the expense
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=expense.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/expense_rejected_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/expense_rejected_email.txt",
|
||||
formatdict=dict(expense=expense),
|
||||
subject="Your expense for %s has been rejected." % expense.camp.title,
|
||||
to_recipients=[expense.user.emailaddress_set.get(primary=True).email],
|
||||
|
@ -54,8 +60,10 @@ def send_accountingsystem_revenue_email(revenue):
|
|||
Sends an email to the accountingsystem with the invoice as an attachment,
|
||||
and with the revenue uuid and description in email subject
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=revenue.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/accountingsystem_revenue_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/accountingsystem_revenue_email.txt",
|
||||
formatdict=dict(revenue=revenue),
|
||||
subject="Revenue %s for %s" % (revenue.pk, revenue.camp.title),
|
||||
to_recipients=[settings.ACCOUNTINGSYSTEM_EMAIL],
|
||||
|
@ -68,8 +76,10 @@ def send_revenue_approved_email(revenue):
|
|||
"""
|
||||
Sends a revenue-approved email to the user who created the revenue
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=revenue.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/revenue_approved_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/revenue_approved_email.txt",
|
||||
formatdict=dict(revenue=revenue),
|
||||
subject="Your revenue for %s has been approved." % revenue.camp.title,
|
||||
to_recipients=[revenue.user.emailaddress_set.get(primary=True).email],
|
||||
|
@ -80,8 +90,10 @@ def send_revenue_rejected_email(revenue):
|
|||
"""
|
||||
Sends an revenue-rejected email to the user who created the revenue
|
||||
"""
|
||||
economy_team = Team.objects.get(camp=revenue.camp, name=settings.ECONOMY_TEAM_NAME)
|
||||
add_outgoing_email(
|
||||
"emails/revenue_rejected_email.txt",
|
||||
responsible_team=economy_team,
|
||||
text_template="emails/revenue_rejected_email.txt",
|
||||
formatdict=dict(revenue=revenue),
|
||||
subject="Your revenue for %s has been rejected." % revenue.camp.title,
|
||||
to_recipients=[revenue.user.emailaddress_set.get(primary=True).email],
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import magic
|
||||
from camps.mixins import CampViewMixin
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
@ -15,8 +16,6 @@ from django.views.generic import (
|
|||
TemplateView,
|
||||
UpdateView,
|
||||
)
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from teams.models import Team
|
||||
from utils.email import add_outgoing_email
|
||||
from utils.mixins import RaisePermissionRequiredMixin
|
||||
|
@ -238,7 +237,10 @@ class ExpenseCreateView(
|
|||
|
||||
# send an email to the economy team
|
||||
add_outgoing_email(
|
||||
"emails/expense_awaiting_approval_email.txt",
|
||||
responsible_team=Team.objects.get(
|
||||
camp=self.camp, name=settings.ECONOMY_TEAM_NAME
|
||||
),
|
||||
text_template="emails/expense_awaiting_approval_email.txt",
|
||||
formatdict=dict(expense=expense),
|
||||
subject="New %s expense for %s Team is awaiting approval"
|
||||
% (expense.camp.title, expense.responsible_team.name),
|
||||
|
@ -405,7 +407,10 @@ class RevenueCreateView(
|
|||
|
||||
# send an email to the economy team
|
||||
add_outgoing_email(
|
||||
"emails/revenue_awaiting_approval_email.txt",
|
||||
responsible_team=Team.objects.get(
|
||||
camp=self.camp, name=settings.ECONOMY_TEAM_NAME
|
||||
),
|
||||
text_template="emails/revenue_awaiting_approval_email.txt",
|
||||
formatdict=dict(revenue=revenue),
|
||||
subject="New %s revenue for %s Team is awaiting approval"
|
||||
% (revenue.camp.title, revenue.responsible_team.name),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from teams.models import Team
|
||||
from utils.models import CreatedUpdatedModel
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from utils.models import CampRelatedModel, UUIDModel
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.views.generic import CreateView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from tokens.models import Token
|
||||
|
||||
from .models import Feedback
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import reversion
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
|
||||
from utils.models import CampRelatedModel
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.views.generic import ListView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from django.views.generic import ListView
|
||||
|
||||
from .models import InfoCategory
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
import asyncio
|
||||
|
||||
import irc3
|
||||
from asgiref.sync import sync_to_async
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
from ircbot.models import OutgoingIrcMessage
|
||||
from teams.models import Team, TeamMember
|
||||
from teams.utils import get_team_from_irc_channel
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from utils.models import CreatedUpdatedModel
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.views.generic import ListView
|
||||
|
||||
from camps.models import Camp
|
||||
from django.views.generic import ListView
|
||||
|
||||
|
||||
class PeopleView(ListView):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from utils.models import CreatedUpdatedModel, UUIDModel
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from channels.generic.websocket import JsonWebsocketConsumer
|
||||
|
||||
from camps.models import Camp
|
||||
from channels.generic.websocket import JsonWebsocketConsumer
|
||||
|
||||
from .models import (
|
||||
Event,
|
||||
|
|
|
@ -17,11 +17,13 @@ def add_new_speaker_proposal_email(speaker_proposal):
|
|||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/new_speaker_proposal.txt",
|
||||
html_template="emails/new_speaker_proposal.html",
|
||||
to_recipients=content_team.mailing_list,
|
||||
formatdict=formatdict,
|
||||
subject="New speaker proposal '%s' was just submitted" % speaker_proposal.name,
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
|
@ -35,11 +37,13 @@ def add_new_event_proposal_email(event_proposal):
|
|||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/new_event_proposal.txt",
|
||||
html_template="emails/new_event_proposal.html",
|
||||
to_recipients=content_team.mailing_list,
|
||||
formatdict=formatdict,
|
||||
subject="New event proposal '%s' was just submitted" % event_proposal.title,
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
|
@ -53,11 +57,13 @@ def add_speaker_proposal_updated_email(speaker_proposal):
|
|||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/update_speaker_proposal.txt",
|
||||
html_template="emails/update_speaker_proposal.html",
|
||||
to_recipients=content_team.mailing_list,
|
||||
formatdict=formatdict,
|
||||
subject="Speaker proposal '%s' was just updated" % speaker_proposal.name,
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
|
@ -71,59 +77,93 @@ def add_event_proposal_updated_email(event_proposal):
|
|||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/update_event_proposal.txt",
|
||||
html_template="emails/update_event_proposal.html",
|
||||
to_recipients=content_team.mailing_list,
|
||||
formatdict=formatdict,
|
||||
subject="Event proposal '%s' was just updated" % event_proposal.title,
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
def add_speaker_proposal_rejected_email(speaker_proposal):
|
||||
formatdict = {"proposal": speaker_proposal}
|
||||
|
||||
try:
|
||||
content_team = Team.objects.get(camp=speaker_proposal.camp, name="Content")
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.info("There is no team with name Content: {}".format(e))
|
||||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/speaker_proposal_rejected.txt",
|
||||
html_template="emails/speaker_proposal_rejected.html",
|
||||
to_recipients=speaker_proposal.user.email,
|
||||
formatdict=formatdict,
|
||||
subject=f"Your {speaker_proposal.camp.title} speaker proposal '{speaker_proposal.name}' was rejected",
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
def add_speaker_proposal_accepted_email(speaker_proposal):
|
||||
formatdict = {"proposal": speaker_proposal}
|
||||
|
||||
try:
|
||||
content_team = Team.objects.get(camp=speaker_proposal.camp, name="Content")
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.info("There is no team with name Content: {}".format(e))
|
||||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/speaker_proposal_accepted.txt",
|
||||
html_template="emails/speaker_proposal_accepted.html",
|
||||
to_recipients=speaker_proposal.user.email,
|
||||
formatdict=formatdict,
|
||||
subject=f"Your {speaker_proposal.camp.title} speaker proposal '{speaker_proposal.name}' was accepted",
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
def add_event_proposal_rejected_email(event_proposal):
|
||||
formatdict = {"proposal": event_proposal}
|
||||
|
||||
try:
|
||||
content_team = Team.objects.get(camp=event_proposal.camp, name="Content")
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.info("There is no team with name Content: {}".format(e))
|
||||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/event_proposal_rejected.txt",
|
||||
html_template="emails/event_proposal_rejected.html",
|
||||
to_recipients=event_proposal.user.email,
|
||||
formatdict=formatdict,
|
||||
subject=f"Your {event_proposal.camp.title} event proposal '{event_proposal.title}' was rejected",
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
def add_event_proposal_accepted_email(event_proposal):
|
||||
formatdict = {"proposal": event_proposal}
|
||||
|
||||
try:
|
||||
content_team = Team.objects.get(camp=event_proposal.camp, name="Content")
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.info("There is no team with name Content: {}".format(e))
|
||||
return False
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/event_proposal_accepted.txt",
|
||||
html_template="emails/event_proposal_accepted.html",
|
||||
to_recipients=event_proposal.user.email,
|
||||
formatdict=formatdict,
|
||||
subject=f"Your {event_proposal.camp.title} event proposal '{event_proposal.title}' was accepted!",
|
||||
hold=True,
|
||||
)
|
||||
|
||||
|
||||
|
@ -131,12 +171,21 @@ def add_event_scheduled_email(eventinstance, action):
|
|||
formatdict = {"eventinstance": eventinstance, "action": action}
|
||||
recipients = [speaker.email for speaker in eventinstance.event.speakers.all()]
|
||||
recipients.append(eventinstance.event.proposal.user.email)
|
||||
|
||||
try:
|
||||
content_team = Team.objects.get(camp=eventinstance.camp, name="Content")
|
||||
except ObjectDoesNotExist as e:
|
||||
logger.info("There is no team with name Content: {}".format(e))
|
||||
return False
|
||||
|
||||
# loop over unique recipients and send an email to each
|
||||
for rcpt in set(recipients):
|
||||
return add_outgoing_email(
|
||||
responsible_team=content_team,
|
||||
text_template="emails/event_scheduled.txt",
|
||||
html_template="emails/event_scheduled.html",
|
||||
to_recipients=rcpt,
|
||||
formatdict=formatdict,
|
||||
subject=f"Your {eventinstance.camp.title} event '{eventinstance.event.title}' has been {action}!",
|
||||
hold=True,
|
||||
)
|
||||
|
|
|
@ -2,11 +2,10 @@ import logging
|
|||
from datetime import timedelta
|
||||
from time import sleep
|
||||
|
||||
from camps.utils import get_current_camp
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from camps.utils import get_current_camp
|
||||
from ircbot.models import OutgoingIrcMessage
|
||||
from program.models import EventInstance
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
# Generated by Django 1.10.5 on 2017-02-18 11:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import program.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -5,11 +5,10 @@ from __future__ import unicode_literals
|
|||
import uuid
|
||||
|
||||
import django.db.models.deletion
|
||||
import program.models
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
import program.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
|
@ -5,11 +5,10 @@ from __future__ import unicode_literals
|
|||
import uuid
|
||||
|
||||
import django.db.models.deletion
|
||||
import program.models
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
import program.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
# Generated by Django 1.10.5 on 2017-03-14 19:12
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import program.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
# Generated by Django 1.10.5 on 2017-03-15 23:04
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import program.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
from utils.models import CampRelatedModel, UUIDModel
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django import forms
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
@ -10,8 +11,7 @@ from django.views.generic import (
|
|||
ListView,
|
||||
UpdateView,
|
||||
)
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from teams.models import Team
|
||||
from utils.email import add_outgoing_email
|
||||
from utils.mixins import UserIsObjectOwnerMixin
|
||||
|
||||
|
@ -44,7 +44,9 @@ class RideDetail(LoginRequiredMixin, CampViewMixin, DetailView):
|
|||
form = ContactRideForm(request.POST)
|
||||
if form.is_valid():
|
||||
ride = self.get_object()
|
||||
info_team = Team.objects.get(camp=self.camp, name="Info")
|
||||
add_outgoing_email(
|
||||
responsible_team=info_team,
|
||||
text_template="rideshare/emails/contact_mail.txt",
|
||||
to_recipients=[ride.user.emailaddress_set.get(primary=True).email],
|
||||
formatdict=dict(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from tickets.admin import ShopTicketInline
|
||||
|
||||
from .models import (
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
|
||||
from vendor.coinify.coinify_api import CoinifyAPI
|
||||
|
||||
from .models import CoinifyAPICallback, CoinifyAPIInvoice, CoinifyAPIRequest
|
||||
|
|
|
@ -5,7 +5,7 @@ from utils.email import add_outgoing_email
|
|||
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||
|
||||
|
||||
def add_creditnote_email(creditnote):
|
||||
def add_creditnote_email(creditnote, camp):
|
||||
# put formatdict together
|
||||
formatdict = {"creditnote": creditnote}
|
||||
|
||||
|
@ -43,11 +43,3 @@ def add_invoice_email(invoice):
|
|||
attachment=invoice.pdf.read(),
|
||||
attachment_filename=invoice.filename,
|
||||
)
|
||||
|
||||
|
||||
def add_test_email(recipient):
|
||||
return add_outgoing_email(
|
||||
text_template="emails/testmail.txt",
|
||||
to_recipients=recipient,
|
||||
subject="testmail from bornhack website",
|
||||
)
|
||||
|
|
|
@ -2,7 +2,6 @@ import factory
|
|||
from django.utils import timezone
|
||||
from factory.django import DjangoModelFactory
|
||||
from psycopg2.extras import DateTimeTZRange
|
||||
|
||||
from utils.factories import UserFactory
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django import forms
|
||||
from django.forms import modelformset_factory
|
||||
|
||||
from shop.models import OrderProductRelation
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
from django.conf import settings
|
||||
from django.core.files import File
|
||||
from django.db.models import Q
|
||||
|
||||
from shop.email import add_creditnote_email, add_invoice_email
|
||||
from shop.models import CreditNote, CustomOrder, Invoice, Order
|
||||
from utils.pdf import generate_pdf_letter
|
||||
|
|
|
@ -2,7 +2,6 @@ from django.test import TestCase
|
|||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from psycopg2.extras import DateTimeTZRange
|
||||
|
||||
from shop.forms import OrderProductRelationForm
|
||||
from tickets.factories import TicketTypeFactory
|
||||
from tickets.models import ShopTicket
|
||||
|
|
|
@ -19,7 +19,6 @@ from django.views.decorators.csrf import csrf_exempt
|
|||
from django.views.generic import DetailView, FormView, ListView, View
|
||||
from django.views.generic.base import RedirectView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
|
||||
from shop.models import (
|
||||
CreditNote,
|
||||
EpayCallback,
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from teams.models import Team
|
||||
from utils.email import add_outgoing_email
|
||||
|
||||
logger = logging.getLogger("bornhack.%s" % __name__)
|
||||
|
@ -24,6 +24,7 @@ def add_sponsorticket_email(ticket):
|
|||
with open(os.path.join(settings.PDF_ARCHIVE_PATH, filename), "rb") as f:
|
||||
# add email to outgoing email queue
|
||||
return add_outgoing_email(
|
||||
responsible_team=Team.objects.get(camp=ticket.sponsor.camp, name="Sponsor"),
|
||||
text_template="emails/sponsorticket_email.txt",
|
||||
html_template="emails/sponsorticket_email.html",
|
||||
to_recipients=ticket.sponsor.ticket_email,
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# coding: utf-8
|
||||
import logging
|
||||
|
||||
from camps.models import Camp
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from camps.models import Camp
|
||||
from sponsors.email import add_sponsorticket_email
|
||||
from sponsors.models import Sponsor
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# coding: utf-8
|
||||
from camps.models import Camp
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from camps.models import Camp
|
||||
from sponsors.models import Sponsor
|
||||
from tickets.models import SponsorTicket, TicketType
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
# Generated by Django 1.11 on 2017-07-11 21:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
import sponsors.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from utils.models import CampRelatedModel
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.views.generic import ListView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from django.views.generic import ListView
|
||||
|
||||
from .models import Sponsor
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from camps.utils import CampPropertyListFilter
|
||||
from django.contrib import admin
|
||||
|
||||
from .email import add_added_membership_email, add_removed_membership_email
|
||||
from .models import Team, TeamMember, TeamShift, TeamTask
|
||||
|
|
|
@ -9,6 +9,7 @@ def add_added_membership_email(membership):
|
|||
formatdict = {"team": membership.team.name, "camp": membership.team.camp.title}
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=membership.team,
|
||||
text_template="emails/add_membership_email.txt",
|
||||
html_template="emails/add_membership_email.html",
|
||||
to_recipients=membership.user.email,
|
||||
|
@ -28,6 +29,7 @@ def add_removed_membership_email(membership):
|
|||
html_template = "emails/unapproved_membership_email.html"
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=membership.team,
|
||||
text_template=text_template,
|
||||
html_template=html_template,
|
||||
to_recipients=membership.user.email,
|
||||
|
@ -40,6 +42,7 @@ def add_new_membership_email(membership):
|
|||
formatdict = {"team": membership.team.name, "camp": membership.team.camp.title}
|
||||
|
||||
return add_outgoing_email(
|
||||
responsible_team=membership.team,
|
||||
text_template="emails/new_membership_email.txt",
|
||||
html_template="emails/new_membership_email.html",
|
||||
to_recipients=[
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django import template
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from teams.models import TeamMember
|
||||
|
||||
register = template.Library()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.urls import include, path
|
||||
|
||||
from teams.views.base import (
|
||||
FixIrcAclView,
|
||||
TeamGeneralView,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
||||
from django.views.generic import DetailView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
|
||||
from ..models import Team, TeamMember
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||
from reversion.views import RevisionMixin
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from info.models import InfoCategory, InfoItem
|
||||
from reversion.views import RevisionMixin
|
||||
|
||||
from ..models import Team
|
||||
from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import logging
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.shortcuts import redirect
|
||||
from django.views.generic import DetailView, UpdateView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from profiles.models import Profile
|
||||
|
||||
from ..email import add_added_membership_email, add_removed_membership_email
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.contrib import messages
|
||||
from django.shortcuts import redirect
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
|
||||
from teams.models import Team, TeamMember
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django import forms
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
|
@ -16,8 +17,6 @@ from django.views.generic import (
|
|||
)
|
||||
from psycopg2.extras import DateTimeTZRange
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
|
||||
from ..models import Team, TeamMember, TeamShift
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from django import forms
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpResponseNotAllowed, HttpResponseRedirect
|
||||
from django.views.generic import CreateView, DetailView, UpdateView
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
|
||||
from ..models import TaskComment, Team, TeamMember, TeamTask
|
||||
from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from shop.models import OrderProductRelation
|
||||
|
||||
from .models import DiscountTicket, ShopTicket, SponsorTicket, TicketType
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Generated by Django 2.2.2 on 2019-07-18 18:52
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
|
||||
from tickets.models import create_ticket_token
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Generated by Django 2.2.3 on 2019-07-24 18:37
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
|
||||
from tickets.models import create_ticket_token
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ from django.conf import settings
|
|||
from django.db import models
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from shop.models import OrderProductRelation
|
||||
from utils.models import CampRelatedModel, UUIDModel
|
||||
from utils.pdf import generate_pdf_letter
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
from django.db.models import Count
|
||||
|
||||
from events.handler import handle_team_event
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.test import TestCase
|
||||
|
||||
from shop.factories import OrderProductRelationFactory
|
||||
|
||||
from .factories import TicketTypeFactory
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from utils.models import CampRelatedModel
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django import template
|
||||
|
||||
from tokens.models import TokenFind
|
||||
|
||||
register = template.Library()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.views.generic import DetailView, ListView
|
||||
|
||||
from utils.models import CampReadOnlyModeError
|
||||
|
||||
from .models import Token, TokenFind
|
||||
|
|
|
@ -6,4 +6,4 @@ from .models import OutgoingEmail
|
|||
@admin.register(OutgoingEmail)
|
||||
class OutgoingEmailAdmin(admin.ModelAdmin):
|
||||
model = OutgoingEmail
|
||||
list_display = ["subject", "to_recipients"]
|
||||
list_display = ["subject", "to_recipients", "processed", "hold", "responsible_team"]
|
||||
|
|
|
@ -74,6 +74,7 @@ def add_outgoing_email(
|
|||
sender="BornHack <info@bornhack.dk>",
|
||||
attachment=None,
|
||||
attachment_filename="",
|
||||
responsible_team=None,
|
||||
hold=False,
|
||||
):
|
||||
""" adds an email to the outgoing queue
|
||||
|
@ -106,6 +107,7 @@ def add_outgoing_email(
|
|||
cc_recipients=cc_recipients,
|
||||
bcc_recipients=bcc_recipients,
|
||||
hold=hold,
|
||||
responsible_team=responsible_team,
|
||||
)
|
||||
|
||||
if attachment:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from camps.mixins import CampViewMixin
|
||||
from camps.models import Camp
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.urls import reverse_lazy
|
||||
|
@ -10,9 +12,6 @@ from django.views.generic import (
|
|||
)
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
|
||||
from camps.mixins import CampViewMixin
|
||||
from camps.models import Camp
|
||||
|
||||
from .mixins import EnsureWritableCampMixin
|
||||
from .models import Village
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class WishlistConfig(AppConfig):
|
||||
name = 'wishlist'
|
||||
name = "wishlist"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Generated by Django 3.0.3 on 2020-02-09 18:24
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -9,25 +9,58 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('teams', '0051_auto_20190312_1129'),
|
||||
("teams", "0051_auto_20190312_1129"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Wish',
|
||||
name="Wish",
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('updated', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(help_text='Short description of the wish', max_length=100)),
|
||||
('slug', models.SlugField(help_text='The url slug for this wish')),
|
||||
('description', models.TextField(help_text='Description of the needed item. Markdown is supported!')),
|
||||
('count', models.IntegerField(default=1, help_text='How many do we need?')),
|
||||
('fulfilled', models.BooleanField(default=False, help_text='A Wish is marked as fulfilled when we no longer need the thing.')),
|
||||
('team', models.ForeignKey(help_text='The team that needs this thing. When in doubt pick Orga :)', on_delete=django.db.models.deletion.PROTECT, related_name='wishes', to='teams.Team')),
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created", models.DateTimeField(auto_now_add=True)),
|
||||
("updated", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"name",
|
||||
models.CharField(
|
||||
help_text="Short description of the wish", max_length=100
|
||||
),
|
||||
),
|
||||
("slug", models.SlugField(help_text="The url slug for this wish")),
|
||||
(
|
||||
"description",
|
||||
models.TextField(
|
||||
help_text="Description of the needed item. Markdown is supported!"
|
||||
),
|
||||
),
|
||||
(
|
||||
"count",
|
||||
models.IntegerField(default=1, help_text="How many do we need?"),
|
||||
),
|
||||
(
|
||||
"fulfilled",
|
||||
models.BooleanField(
|
||||
default=False,
|
||||
help_text="A Wish is marked as fulfilled when we no longer need the thing.",
|
||||
),
|
||||
),
|
||||
(
|
||||
"team",
|
||||
models.ForeignKey(
|
||||
help_text="The team that needs this thing. When in doubt pick Orga :)",
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="wishes",
|
||||
to="teams.Team",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
options={"abstract": False,},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.urls import path
|
||||
from .views import WishListView, WishDetailView
|
||||
|
||||
from .views import WishDetailView, WishListView
|
||||
|
||||
app_name = "wishlist"
|
||||
urlpatterns = [
|
||||
|
|
Loading…
Reference in a new issue