Moved the tokens created so far into a migration
- Legacy-Id: 9994
This commit is contained in:
parent
7649397f5b
commit
aebd885f2b
147
ietf/mailtoken/migrations/0002_auto_20150809_1314.py
Normal file
147
ietf/mailtoken/migrations/0002_auto_20150809_1314.py
Normal file
|
@ -0,0 +1,147 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
def make_recipients(apps):
|
||||
|
||||
Recipient=apps.get_model('mailtoken','Recipient')
|
||||
|
||||
rc = Recipient.objects.create
|
||||
|
||||
rc(slug='iesg',
|
||||
desc='The IESG',
|
||||
template='The IESG <iesg@ietf.org>')
|
||||
|
||||
rc(slug='ietf_announce',
|
||||
desc='The IETF Announce list',
|
||||
template='IETF-Announce <ietf-announce@ietf.org>')
|
||||
|
||||
rc(slug='rfc_editor',
|
||||
desc='The RFC Editor',
|
||||
template='<rfc-editor@rfc-editor.org>')
|
||||
|
||||
rc(slug='iesg_secretary',
|
||||
desc='The Secretariat',
|
||||
template='<iesg-secretary@ietf.org>')
|
||||
|
||||
rc(slug='doc_authors',
|
||||
desc="The document's authors",
|
||||
template='{{doc.name}}@ietf.org')
|
||||
|
||||
rc(slug='doc_notify',
|
||||
desc="The addresses in the document's notify field",
|
||||
template='{{doc.notify}}')
|
||||
|
||||
rc(slug='doc_group_chairs',
|
||||
desc="The document's group chairs (if the document is assigned to a working or research group)",
|
||||
template=None)
|
||||
|
||||
rc(slug='doc_affecteddoc_authors',
|
||||
desc="The authors of the subject documents of a conflict-review or status-change",
|
||||
template=None)
|
||||
|
||||
rc(slug='doc_affecteddoc_group_chairs',
|
||||
desc="The chairs of groups of the subject documents of a conflict-review or status-change",
|
||||
template=None)
|
||||
|
||||
rc(slug='doc_shepherd',
|
||||
desc="The document's shepherd",
|
||||
template='{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}' )
|
||||
|
||||
rc(slug='doc_ad',
|
||||
desc="The document's responsible Area Director",
|
||||
template='{% if doc.ad %}{{doc.ad.email_address}}{% endif %}' )
|
||||
|
||||
rc(slug='doc_group_mail_list',
|
||||
desc="The list address of the document's group",
|
||||
template=None )
|
||||
|
||||
rc(slug='conflict_review_stream_owner',
|
||||
desc="The stream owner of a document being reviewed for IETF stream conflicts",
|
||||
template='{% ifequal doc.type_id "conflrev" %}{% ifequal doc.stream_id "ise" %}<rfc-ise@rfc-editor.org>{% endifequal %}{% ifequal doc.stream_id "irtf" %}<irtf-chair@irtf.org>{% endifequal %}{% endifequal %}')
|
||||
|
||||
rc(slug='iana_approve',
|
||||
desc="IANA's draft approval address",
|
||||
template='IANA <drafts-approval@icann.org>')
|
||||
|
||||
def make_mailtokens(apps):
|
||||
|
||||
Recipient=apps.get_model('mailtoken','Recipient')
|
||||
MailToken=apps.get_model('mailtoken','MailToken')
|
||||
|
||||
def mt_factory(slug,desc,recipient_slugs):
|
||||
m = MailToken.objects.create(slug=slug, desc=desc)
|
||||
m.recipients = Recipient.objects.filter(slug__in=recipient_slugs)
|
||||
|
||||
mt_factory(slug='ballot_saved',
|
||||
desc='Recipients when a new ballot position (with discusses, other blocking positions, or comments) is saved',
|
||||
recipient_slugs=['iesg'])
|
||||
|
||||
mt_factory(slug='ballot_saved_cc',
|
||||
desc='Copied when a new ballot position (with discusses, other blocking positions, or comments) is saved',
|
||||
recipient_slugs=['doc_authors',
|
||||
'doc_group_chairs',
|
||||
'doc_shepherd',
|
||||
'doc_affecteddoc_authors',
|
||||
'doc_affecteddoc_group_chairs',
|
||||
'conflict_review_stream_owner',
|
||||
])
|
||||
|
||||
mt_factory(slug='ballot_deferred',
|
||||
desc='Recipients when a ballot is deferred to or undeferred from a future telechat',
|
||||
recipient_slugs=['iesg',
|
||||
'iesg_secretary',
|
||||
'doc_group_chairs',
|
||||
'doc_notify',
|
||||
'doc_authors',
|
||||
'doc_shepherd',
|
||||
'doc_affecteddoc_authors',
|
||||
'doc_affecteddoc_group_chairs',
|
||||
'conflict_review_stream_owner',
|
||||
])
|
||||
|
||||
mt_factory(slug='ballot_approved_ietf_stream',
|
||||
desc='Recipients when an IETF stream document ballot is approved',
|
||||
recipient_slugs=['ietf_announce'])
|
||||
|
||||
mt_factory(slug='ballot_approved_ietf_stream_cc',
|
||||
desc='Copied when an IETF stream document ballot is approved',
|
||||
recipient_slugs=['iesg',
|
||||
'doc_notify',
|
||||
'doc_ad',
|
||||
'doc_authors',
|
||||
'doc_shepherd',
|
||||
'doc_group_mail_list',
|
||||
'doc_group_chairs',
|
||||
'rfc_editor',
|
||||
])
|
||||
|
||||
mt_factory(slug='ballot_approved_ietf_stream_iana',
|
||||
desc='Recipients for IANA message when an IETF stream document ballot is approved',
|
||||
recipient_slugs=['iana_approve'])
|
||||
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
|
||||
make_recipients(apps)
|
||||
make_mailtokens(apps)
|
||||
|
||||
def reverse(apps, schema_editor):
|
||||
|
||||
Recipient=apps.get_model('mailtoken','Recipient')
|
||||
MailToken=apps.get_model('mailtoken','MailToken')
|
||||
|
||||
Recipient.objects.all().delete()
|
||||
MailToken.objects.all().delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailtoken', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forward, reverse)
|
||||
]
|
|
@ -67,101 +67,3 @@ class Recipient(models.Model):
|
|||
addrs.extend(Recipient.objects.get(slug='doc_group_chairs').gather(**{'doc':reldoc.document}))
|
||||
return addrs
|
||||
|
||||
def make_recipients():
|
||||
|
||||
Recipient.objects.all().delete()
|
||||
Recipient.objects.create(slug='iesg',
|
||||
desc='The IESG',
|
||||
template='The IESG <iesg@ietf.org>')
|
||||
Recipient.objects.create(slug='ietf_announce',
|
||||
desc='The IETF Announce list',
|
||||
template='IETF-Announce <ietf-announce@ietf.org>')
|
||||
Recipient.objects.create(slug='rfc_editor',
|
||||
desc='The RFC Editor',
|
||||
template='<rfc-editor@rfc-editor.org>')
|
||||
Recipient.objects.create(slug='iesg_secretary',
|
||||
desc='The Secretariat',
|
||||
template='<iesg-secretary@ietf.org>')
|
||||
Recipient.objects.create(slug='doc_authors',
|
||||
desc="The document's authors",
|
||||
template='{{doc.name}}@ietf.org')
|
||||
Recipient.objects.create(slug='doc_notify',
|
||||
desc="The addresses in the document's notify field",
|
||||
template='{{doc.notify}}')
|
||||
Recipient.objects.create(slug='doc_group_chairs',
|
||||
desc="The document's group chairs (if the document is assigned to a working or research group)",
|
||||
template=None)
|
||||
Recipient.objects.create(slug='doc_affecteddoc_authors',
|
||||
desc="The authors of the subject documents of a conflict-review or status-change",
|
||||
template=None)
|
||||
Recipient.objects.create(slug='doc_affecteddoc_group_chairs',
|
||||
desc="The chairs of groups of the subject documents of a conflict-review or status-change",
|
||||
template=None)
|
||||
Recipient.objects.create(slug='doc_shepherd',
|
||||
desc="The document's shepherd",
|
||||
template='{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}' )
|
||||
Recipient.objects.create(slug='doc_ad',
|
||||
desc="The document's responsible Area Director",
|
||||
template='{% if doc.ad %}{{doc.ad.email_address}}{% endif %}' )
|
||||
Recipient.objects.create(slug='doc_group_mail_list',
|
||||
desc="The list address of the document's group",
|
||||
template=None )
|
||||
Recipient.objects.create(slug='conflict_review_stream_owner',
|
||||
desc="The stream owner of a document being reviewed for IETF stream conflicts",
|
||||
template='{% ifequal doc.type_id "conflrev" %}{% ifequal doc.stream_id "ise" %}<rfc-ise@rfc-editor.org>{% endifequal %}{% ifequal doc.stream_id "irtf" %}<irtf-chair@irtf.org>{% endifequal %}{% endifequal %}')
|
||||
Recipient.objects.create(slug='iana_approve',
|
||||
desc="IANA's draft approval address",
|
||||
template='IANA <drafts-approval@icann.org>')
|
||||
|
||||
def make_mailtokens():
|
||||
|
||||
MailToken.objects.all().delete()
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_saved',
|
||||
desc='Recipients when a new ballot position (with discusses, other blocking positions, or comments) is saved')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['iesg'])
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_saved_cc',
|
||||
desc='Copied when a new ballot position (with discusses, other blocking positions, or comments) is saved')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['doc_authors',
|
||||
'doc_group_chairs',
|
||||
'doc_shepherd',
|
||||
'doc_affecteddoc_authors',
|
||||
'doc_affecteddoc_group_chairs',
|
||||
'conflict_review_stream_owner',
|
||||
])
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_deferred',
|
||||
desc='Recipients when a ballot is deferred to or undeferred from a future telechat')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['iesg',
|
||||
'iesg_secretary',
|
||||
'doc_group_chairs',
|
||||
'doc_notify',
|
||||
'doc_authors',
|
||||
'doc_shepherd',
|
||||
'doc_affecteddoc_authors',
|
||||
'doc_affecteddoc_group_chairs',
|
||||
'conflict_review_stream_owner',
|
||||
])
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_approved_ietf_stream',
|
||||
desc='Recipients when an IETF stream document ballot is approved')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['ietf_announce'])
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_approved_ietf_stream_cc',
|
||||
desc='Copied when an IETF stream document ballot is approved')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['iesg',
|
||||
'doc_notify',
|
||||
'doc_ad',
|
||||
'doc_authors',
|
||||
'doc_shepherd',
|
||||
'doc_group_mail_list',
|
||||
'doc_group_chairs',
|
||||
'rfc_editor',
|
||||
])
|
||||
|
||||
m = MailToken.objects.create(slug='ballot_approved_ietf_stream_iana',
|
||||
desc='Recipients for IANA message when an IETF stream document ballot is approved')
|
||||
m.recipients = Recipient.objects.filter(slug__in=['iana_approve'])
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Recipient</th>
|
||||
<th>Events</th>
|
||||
<th>Tokens</th>
|
||||
<th>Template</th>
|
||||
<th>Code</th>
|
||||
</tr>
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||
{% load origin %}
|
||||
|
||||
{% block title %}Mail Events{% endblock %}
|
||||
{% block title %}Mail Tokens{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% origin %}
|
||||
<h1>Mail Events</h1>
|
||||
<h1>Mail Tokens</h1>
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Event</th>
|
||||
<th>Token</th>
|
||||
<th>Recipients</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
Loading…
Reference in a new issue