Verified Commit 177ff19e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'renovate/configure' of gitlab.science.ru.nl:thalia/concrxit into renovate/configure

parents 0e18b0e3 71373107
......@@ -201,6 +201,8 @@ build production docker image:
extends: build docker image
only:
- tags
except:
- master
after_script:
- docker tag $DOCKER_TAG $DOCKER_TAG_PRODUCTION
- docker tag $DOCKER_TAG $DOCKER_LATEST
......
......@@ -2,6 +2,7 @@
import datetime
import logging
from django.conf import settings
from django.contrib.auth.models import Permission
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.core.validators import MinValueValidator
......@@ -102,7 +103,7 @@ class MemberGroup(models.Model, metaclass=ModelTranslateMeta):
@property
def contact_address(self):
if self.contact_mailinglist:
return f"{self.contact_mailinglist.name}@thalia.nu"
return f"{self.contact_mailinglist.name}@{settings.SITE_DOMAIN}"
return self.contact_email
def clean(self):
......
"""The feeds defined by the events package"""
from django.conf import settings
from django.db.models.query_utils import Q
from django.contrib.sites.models import Site
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import activate
from django.utils.translation import ugettext as _
from django_ical.views import ICalFeed
from events.models import Event, FeedToken
......@@ -25,7 +25,7 @@ class EventFeed(ICalFeed):
return super().__call__(request, args, kwargs)
def product_id(self):
return '-//thalia.nu//EventCalendar//' + self.lang.upper()
return f'-//{settings.SITE_DOMAIN}//EventCalendar//{self.lang.upper()}'
def file_name(self):
return "thalia_{}.ics".format(self.lang)
......@@ -47,10 +47,8 @@ class EventFeed(ICalFeed):
return item.title
def item_description(self, item):
return (item.description +
' <a href="https://%s%s">Website</a>' %
(Site.objects.get_current().domain,
self.item_link(item)))
return (f'{item.description} <a href="https://'
f'{self.item_link(item)}">Website</a>')
def item_start_datetime(self, item):
return item.start
......@@ -59,7 +57,10 @@ class EventFeed(ICalFeed):
return item.end
def item_link(self, item):
return reverse('events:event', kwargs={'pk': item.id})
return (
settings.BASE_URL +
reverse('events:event', kwargs={'pk': item.id})
)
def item_location(self, item):
return "{} - {}".format(item.location, item.map_location)
......@@ -11,15 +11,19 @@ class RegistrationAdminForm(forms.ModelForm):
Custom admin form to add a link to the registration information
fields admin
"""
fields = forms.URLField(widget=FieldsWidget)
fields = forms.URLField(widget=FieldsWidget, required=False)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.instance.event.has_fields():
self.fields['fields'].initial = (
reverse('admin:events_registration_fields',
args=[self.instance.pk]))
else:
try:
if self.instance.event.has_fields():
self.fields['fields'].initial = (
reverse('admin:events_registration_fields',
args=[self.instance.pk]))
else:
self.fields['fields'].widget = self.fields[
'fields'].hidden_widget()
except Event.DoesNotExist:
self.fields['fields'].widget = self.fields[
'fields'].hidden_widget()
......
......@@ -39,6 +39,10 @@
<th>{% trans "location"|capfirst %}</th>
<td>{{ event.location }}</td>
</tr>
<tr>
<th>{% trans "organiser"|capfirst %}</th>
<td><a href={{ event.organiser.get_absolute_url }}>{{ event.organiser }}</a></td>
</tr>
{% if event.price > 0 %}
<tr>
<th>{% trans "price"|capfirst %}</th>
......
......@@ -20,7 +20,8 @@ def get_automatic_lists():
.filter(group__board=None)
.filter(group__society=None)
.prefetch_related('member'))
active_members = [x.member for x in active_committee_memberships]
active_members = list(set(
[x.member for x in active_committee_memberships]))
lectureyear = datetime_to_lectureyear(timezone.now())
# Change to next lecture year after December
......
......@@ -43,7 +43,7 @@ def send_membership_announcement(dry_run=False):
'[THALIA] {}'.format(
_('Membership announcement')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
bcc=[settings.BOARD_NOTIFICATION_ADDRESS],
connection=connection
......@@ -101,7 +101,7 @@ def send_information_request(dry_run=False):
'[THALIA] {}'.format(
_('Membership information check')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
connection=connection
).send()
......@@ -153,7 +153,7 @@ def send_expiration_announcement(dry_run=False):
'[THALIA] {}'.format(
_('Membership expiration announcement')),
email_body,
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email],
bcc=[settings.BOARD_NOTIFICATION_ADDRESS],
connection=connection
......@@ -183,7 +183,8 @@ def send_welcome_message(user, password, language):
{
'full_name': user.get_full_name(),
'username': user.username,
'password': password
'password': password,
'url': settings.BASE_URL
})
user.email_user(
_('Welcome to Study Association Thalia'),
......@@ -213,7 +214,7 @@ def send_email_change_confirmation_messages(change_request):
'name': member.first_name
}
),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[member.email]
).send()
......@@ -231,7 +232,7 @@ def send_email_change_confirmation_messages(change_request):
'name': member.first_name
}
),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[change_request.email]
).send()
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-03 19:25+0200\n"
"PO-Revision-Date: 2019-04-03 19:30+0200\n"
"POT-Creation-Date: 2019-04-09 21:17+0200\n"
"PO-Revision-Date: 2019-04-09 21:18+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n"
"Language: nl\n"
......@@ -90,6 +90,20 @@ msgstr "Studentnummer"
msgid "Download student number label for selected users"
msgstr "Download studentnummers voor geselecteerde gebruikers"
#: admin.py
msgid "Data minimisation could not be executed for the selected user(s)."
msgstr ""
"Gegevensminimisatie kon niet worden uitgevoerd voor de geselecteerde "
"gebruiker(s)."
#: admin.py
msgid "Data minimisation was executed for {} user(s)."
msgstr "Gegevensminimisatie is uitgevoerd voor {} gebruiker(s)."
#: admin.py
msgid "Minimise data for the selected users"
msgstr "Minimiseer gegevens voor de geselecteerde gebruikers"
#: apps.py
msgid "Members"
msgstr "Leden"
......@@ -883,7 +897,7 @@ msgid ""
"Dear %(full_name)s,\n"
"\n"
"Welcome to Study Association Thalia! You now have an account and can\n"
"log in at https://thalia.nu/.\n"
"log in at %(url)s.\n"
"\n"
"Your username is: %(username)s\n"
"Your password is: %(password)s\n"
......@@ -901,7 +915,7 @@ msgstr ""
"Beste %(full_name)s,\n"
"\n"
"Welkom bij Studievereniging Thalia! Je hebt nu een account zodat \n"
"je kunt inloggen op https://thalia.nu/.\n"
"je kunt inloggen op %(url)s.\n"
"\n"
"Dit zijn je gebruikersnaam en wachtwoord: \n"
"Je gebruikersnaam is: %(username)s\n"
......
{% load i18n %}{% blocktrans %}Dear {{ full_name }},
Welcome to Study Association Thalia! You now have an account and can
log in at https://thalia.nu/.
log in at {{ url }}.
Your username is: {{ username }}
Your password is: {{ password }}
......
......@@ -42,6 +42,7 @@ class NewsletterEventForm(NewsletterItemForm):
(e.pk, e.title_nl) for e in
Event.objects.filter(published=True, start__gt=timezone.now())
]
self.fields['event'].required = False
class Meta:
fields = ('event', 'title_en', 'title_nl',
......
......@@ -40,12 +40,12 @@ django.jQuery(function () {
var seconds = date.getSeconds();
if (format === 'time') {
return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds);
return pad(hours, 2) + ':' + pad(minutes, 2) + ':' + pad(seconds, 2);
}
if (currentLang === 'nl') {
return pad(day) + '-' + pad(month) + '-' + pad(year);
return pad(day, 2) + '-' + pad(month, 2) + '-' + year;
}
return pad(year) + '-' + pad(month) + '-' + pad(day);
return year + '-' + pad(month, 2) + '-' + day;
}
function setFields(id, data, lang) {
......
......@@ -47,7 +47,7 @@ class OrderViewset(ModelViewSet):
def get_queryset(self):
event = PizzaEvent.current()
if can_change_order(self.request.user, event):
if can_change_order(self.request.member, event):
return Order.objects.filter(pizza_event=event)
if self.action == 'update' or self.action == 'destroy':
if not event or event.has_ended:
......@@ -60,14 +60,14 @@ class OrderViewset(ModelViewSet):
pizza_event=event)
def get_serializer_class(self):
if (can_change_order(self.request.member,
self.get_object().pizza_event) and
self.action.endswith('update')):
if (self.action.endswith('update') and
can_change_order(self.request.member,
self.get_object().pizza_event)):
return serializers.AdminOrderSerializer
return serializers.OrderSerializer
def get_object(self):
if self.kwargs[self.lookup_field] == 'me':
if self.kwargs.get(self.lookup_field) == 'me':
order = get_object_or_404(self.get_queryset(),
member=self.request.member,
pizza_event=PizzaEvent.current())
......@@ -80,7 +80,9 @@ class OrderViewset(ModelViewSet):
if serializer.validated_data.get('name'):
serializer.save(pizza_event=PizzaEvent.current())
else:
if self.request.user.has_perm('pizzas.change_order'):
if (self.action.endswith('update') and
can_change_order(self.request.member,
PizzaEvent.current())):
serializer.save(pizza_event=PizzaEvent.current())
else:
serializer.save(member=self.request.member,
......
......@@ -38,5 +38,5 @@ def gen_stats_current_pizza_orders():
def can_change_order(member, pizza_event):
return (member.has_perm('pizzas.change_order') and
return (pizza_event and member.has_perm('pizzas.change_order') and
is_organiser(member, pizza_event.event))
......@@ -81,8 +81,9 @@ def send_new_registration_board_message(entry):
'registrations/email/registration_board.txt',
{
'name': entry.registration.get_full_name(),
'url': reverse('admin:registrations_registration_change',
args=[entry.registration.pk])
'url': settings.BASE_URL
+ reverse('admin:registrations_registration_change',
args=[entry.registration.pk])
}
)
except models.Registration.DoesNotExist:
......@@ -154,8 +155,9 @@ def send_new_renewal_board_message(renewal):
'registrations/email/renewal_board.txt',
{
'name': renewal.member.get_full_name(),
'url': reverse('admin:registrations_renewal_change',
args=[renewal.pk])
'url': settings.BASE_URL
+ reverse('admin:registrations_renewal_change',
args=[renewal.pk])
}
)
......@@ -172,6 +174,6 @@ def _send_email(to, subject, body_template, context):
mail.EmailMessage(
'[THALIA] {}'.format(subject),
loader.render_to_string(body_template, context),
settings.WEBSITE_FROM_ADDRESS,
settings.DEFAULT_FROM_EMAIL,
[to]
).send()
......@@ -3,7 +3,7 @@ Dear board,
A new membership registration has been submitted by {{ name }}.
Open the following url to review this submission:
https://thalia.nu{{ url }}
{{ url }}
Kisses,
......
......@@ -3,7 +3,7 @@ Dear board,
A new membership renewal has been submitted by {{ name }}.
Open the following url to review this submission:
https://thalia.nu{{ url }}
{{ url }}
Kisses,
......
......@@ -38,10 +38,10 @@ class EmailsTest(TestCase):
'registrations/email/registration_confirm_mail.txt',
{
'name': reg.get_full_name(),
'confirm_link': '{}{}'.format(
'https://thalia.nu',
reverse('registrations:confirm-email',
args=[reg.pk])
'confirm_link': (
'https://thalia.localhost'
+ reverse("registrations:confirm-email",
args=[reg.pk])
)
}
)
......@@ -114,8 +114,11 @@ class EmailsTest(TestCase):
'registrations/email/registration_board.txt',
{
'name': entry.registration.get_full_name(),
'url': reverse('admin:registrations_registration_change',
args=[entry.registration.pk])
'url': (
'https://thalia.localhost'
+ reverse('admin:registrations_registration_change',
args=[entry.registration.pk])
)
}
)
......@@ -235,8 +238,11 @@ class EmailsTest(TestCase):
'registrations/email/renewal_board.txt',
{
'name': renewal.member.get_full_name(),
'url': reverse('admin:registrations_renewal_change',
args=[renewal.pk])
'url': (
'https://thalia.localhost'
+ reverse('admin:registrations_renewal_change',
args=[renewal.pk])
)
}
)
......
......@@ -205,9 +205,11 @@ class RegistrationTest(TestCase):
with self.subTest(f'Create confirmation mail'
f'on save with status confirm'):
self.assertEqual(len(mail.outbox), 1)
confirm_url = '{}{}'.format('https://thalia.nu',
reverse('registrations:confirm-email',
args=[registration.pk]))
confirm_url = (
'https://thalia.localhost' +
reverse('registrations:confirm-email',
args=[registration.pk])
)
self.assertTrue(confirm_url in mail.outbox[0].body)
mail.outbox.clear()
......
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