forked from extern/django-helpdesk
Merge pull request #901 from koriaf/master
fix(migrations): Fix the 0034 migration for Postgres
This commit is contained in:
commit
c8980b3392
@ -8,20 +8,22 @@ def clear_secret_keys(apps, schema_editor):
|
|||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
|
|
||||||
for ticket in Ticket.objects.using(db_alias).all():
|
for ticket in Ticket.objects.using(db_alias).all():
|
||||||
ticket.secret_key=''
|
ticket.secret_key = ''
|
||||||
ticket.save()
|
ticket.save()
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('helpdesk', '0018_fix_migrations'),
|
('helpdesk', '0018_ticket_secret_key'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ticket',
|
model_name='ticket',
|
||||||
name='secret_key',
|
name='secret_key',
|
||||||
field=models.CharField(default=helpdesk.models.mk_secret, max_length=36, verbose_name='Secret key needed for viewing/editing ticket by non-logged in users'),
|
field=models.CharField(default=helpdesk.models.mk_secret, max_length=36,
|
||||||
|
verbose_name='Secret key needed for viewing/editing ticket by non-logged in users'),
|
||||||
),
|
),
|
||||||
migrations.RunPython(clear_secret_keys),
|
migrations.RunPython(clear_secret_keys),
|
||||||
]
|
]
|
||||||
|
@ -7,6 +7,7 @@ def forwards_func(apps, schema_editor):
|
|||||||
EmailTemplate = apps.get_model("helpdesk", "EmailTemplate")
|
EmailTemplate = apps.get_model("helpdesk", "EmailTemplate")
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
EmailTemplate.objects.using(db_alias).create(
|
EmailTemplate.objects.using(db_alias).create(
|
||||||
|
id=EmailTemplate.objects.order_by('-id').first().id + 1, # because PG sequences are not reset
|
||||||
template_name='merged',
|
template_name='merged',
|
||||||
subject='(Merged)',
|
subject='(Merged)',
|
||||||
heading='Ticket merged',
|
heading='Ticket merged',
|
||||||
@ -23,6 +24,7 @@ From now on, please answer on this ticket, or you can include the tag {{ ticket.
|
|||||||
locale='en'
|
locale='en'
|
||||||
)
|
)
|
||||||
EmailTemplate.objects.using(db_alias).create(
|
EmailTemplate.objects.using(db_alias).create(
|
||||||
|
id=EmailTemplate.objects.order_by('-id').first().id + 1, # because PG sequences are not reset
|
||||||
template_name='merged',
|
template_name='merged',
|
||||||
subject='(Fusionné)',
|
subject='(Fusionné)',
|
||||||
heading='Ticket Fusionné',
|
heading='Ticket Fusionné',
|
||||||
@ -32,7 +34,7 @@ Ce courriel indicatif permet de vous prévenir que le ticket {{ ticket.ticket }
|
|||||||
|
|
||||||
Veillez à répondre sur ce ticket dorénavant, ou bien inclure la balise {{ ticket.merged_to.ticket }} dans le sujet de votre réponse par mail.""",
|
Veillez à répondre sur ce ticket dorénavant, ou bien inclure la balise {{ ticket.merged_to.ticket }} dans le sujet de votre réponse par mail.""",
|
||||||
html="""<p style="font-family: sans-serif; font-size: 1em;">Bonjour,</p>
|
html="""<p style="font-family: sans-serif; font-size: 1em;">Bonjour,</p>
|
||||||
|
|
||||||
<p style="font-family: sans-serif; font-size: 1em;">Ce courriel indicatif permet de vous prévenir que le ticket <b>{{ ticket.ticket }}</b> (<em>{{ ticket.title }}</em>) par {{ ticket.submitter_email }} a été fusionné au ticket <a href="{{ ticket.merged_to.staff_url }}">{{ ticket.merged_to.ticket }}</a>.</p>
|
<p style="font-family: sans-serif; font-size: 1em;">Ce courriel indicatif permet de vous prévenir que le ticket <b>{{ ticket.ticket }}</b> (<em>{{ ticket.title }}</em>) par {{ ticket.submitter_email }} a été fusionné au ticket <a href="{{ ticket.merged_to.staff_url }}">{{ ticket.merged_to.ticket }}</a>.</p>
|
||||||
|
|
||||||
<p style="font-family: sans-serif; font-size: 1em;">Veillez à répondre sur ce ticket dorénavant, ou bien inclure la balise <b>{{ ticket.merged_to.ticket }}</b> dans le sujet de votre réponse par mail.</p>""",
|
<p style="font-family: sans-serif; font-size: 1em;">Veillez à répondre sur ce ticket dorénavant, ou bien inclure la balise <b>{{ ticket.merged_to.ticket }}</b> dans le sujet de votre réponse par mail.</p>""",
|
||||||
|
Loading…
Reference in New Issue
Block a user