mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
Refactor mailings email
This commit is contained in:
@ -36,7 +36,6 @@ from django.utils.translation import ugettext as _t
|
||||
from ajax_select.fields import AutoCompleteSelectField
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.core.validators import RegexValidator, validate_email
|
||||
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin
|
||||
from core.views.forms import SelectDate, SelectDateTime
|
||||
@ -55,16 +54,6 @@ class MailingForm(forms.ModelForm):
|
||||
model = Mailing
|
||||
fields = ('email', 'club', 'moderator')
|
||||
|
||||
email = forms.CharField(
|
||||
label=_('Email address'),
|
||||
validators=[
|
||||
RegexValidator(
|
||||
validate_email.user_regex,
|
||||
_('Enter a valid address. Only the root of the address is needed.')
|
||||
)
|
||||
],
|
||||
required=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
club_id = kwargs.pop('club_id', None)
|
||||
user_id = kwargs.pop('user_id', -1) # Remember 0 is treated as None
|
||||
@ -78,12 +67,6 @@ class MailingForm(forms.ModelForm):
|
||||
self.fields['moderator'].initial = user_id
|
||||
self.fields['moderator'].widget = forms.HiddenInput()
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(MailingForm, self).clean()
|
||||
if self.is_valid():
|
||||
cleaned_data['email'] += '@' + settings.SITH_MAILING_DOMAIN
|
||||
return cleaned_data
|
||||
|
||||
|
||||
class MailingSubscriptionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
Reference in New Issue
Block a user