2017-08-22 20:39:12 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
2024-06-24 11:07:36 +00:00
|
|
|
|
2017-08-22 20:39:12 +00:00
|
|
|
import django.core.validators
|
2019-10-05 22:32:54 +00:00
|
|
|
import django.db.models.deletion
|
2024-06-24 11:07:36 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.db import migrations, models
|
2017-08-22 20:39:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
2018-10-04 19:29:19 +00:00
|
|
|
("club", "0008_auto_20170515_2214"),
|
2017-08-22 20:39:12 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="Mailing",
|
2017-08-22 20:39:12 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True,
|
|
|
|
verbose_name="ID",
|
|
|
|
serialize=False,
|
|
|
|
primary_key=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"email",
|
|
|
|
models.CharField(
|
|
|
|
max_length=256,
|
|
|
|
unique=True,
|
|
|
|
validators=[
|
|
|
|
django.core.validators.RegexValidator(
|
|
|
|
re.compile(
|
|
|
|
"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\\Z|^\"([\\001-\\010\\013\\014\\016-\\037!#-\\[\\]-\\177]|\\\\[\\001-\\011\\013\\014\\016-\\177])*\"\\Z)",
|
|
|
|
34,
|
|
|
|
),
|
|
|
|
"Enter a valid address. Only the root of the address is needed.",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
verbose_name="Email address",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"is_moderated",
|
|
|
|
models.BooleanField(default=False, verbose_name="is moderated"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"club",
|
|
|
|
models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
verbose_name="Club",
|
|
|
|
related_name="mailings",
|
|
|
|
to="club.Club",
|
2018-10-04 19:29:19 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"moderator",
|
|
|
|
models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2018-10-04 19:29:19 +00:00
|
|
|
null=True,
|
|
|
|
verbose_name="moderator",
|
|
|
|
related_name="moderated_mailings",
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
),
|
|
|
|
),
|
2017-08-22 20:39:12 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="MailingSubscription",
|
2017-08-22 20:39:12 +00:00
|
|
|
fields=[
|
2018-10-04 19:29:19 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True,
|
|
|
|
verbose_name="ID",
|
|
|
|
serialize=False,
|
|
|
|
primary_key=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"email",
|
|
|
|
models.EmailField(max_length=254, verbose_name="Email address"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"mailing",
|
|
|
|
models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2018-10-04 19:29:19 +00:00
|
|
|
verbose_name="Mailing",
|
|
|
|
related_name="subscriptions",
|
|
|
|
to="club.Mailing",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"user",
|
|
|
|
models.ForeignKey(
|
2019-10-05 22:32:54 +00:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2018-10-04 19:29:19 +00:00
|
|
|
null=True,
|
|
|
|
verbose_name="User",
|
|
|
|
related_name="mailing_subscriptions",
|
|
|
|
blank=True,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
),
|
|
|
|
),
|
2017-08-22 20:39:12 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.AlterUniqueTogether(
|
2018-10-04 19:29:19 +00:00
|
|
|
name="mailingsubscription",
|
|
|
|
unique_together=set([("user", "email", "mailing")]),
|
2017-08-22 20:39:12 +00:00
|
|
|
),
|
|
|
|
]
|