mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-14 01:58:28 +02:00
.github
.tx
demo
docs
helpdesk
fixtures
locale
management
migrations
0001_initial.py
0002_populate_usersettings.py
0003_initial_data_import.py
0004_add_per_queue_staff_membership.py
0005_queues_no_null.py
0006_email_maxlength.py
0007_max_length_by_integer.py
0008_extra_for_permissions.py
0009_migrate_queuemembership.py
0010_remove_queuemembership.py
0011_admin_related_improvements.py
0012_queue_default_owner.py
0013_email_box_local_dir_and_logging.py
0014_usersettings_related_name.py
0015_expand_permission_name_size.py
0016_alter_model_options.py
0017_default_owner_on_delete_null.py
0018_ticket_secret_key.py
0019_ticket_secret_key.py
0020_depickle_user_settings.py
0021_voting_tracker.py
0022_add_submitter_email_id_field_to_ticket.py
0023_add_enable_notifications_on_email_events_to_ticket.py
0024_time_spent.py
0025_queue_dedicated_time.py
0026_kbitem_attachments.py
0027_auto_20200107_1221.py
0028_kbitem_team.py
0029_kbcategory_public.py
0030_add_kbcategory_name.py
0031_auto_20200225_1440.py
0032_kbitem_enabled.py
0033_ticket_merged_to.py
0034_create_email_template_for_merged.py
0035_alter_email_on_ticket_change.py
0036_add_attachment_validator.py
0037_alter_queue_email_box_type.py
0038_checklist_checklisttemplate_checklisttask.py
__init__.py
static
templates
templatetags
tests
views
.flake8
__init__.py
admin.py
apps.py
decorators.py
email.py
exceptions.py
forms.py
lib.py
models.py
poll_helpdesk_email_queues.sh
query.py
serializers.py
settings.py
tasks.py
templated_email.py
update_ticket.py
urls.py
user.py
validators.py
standalone
.coveragerc
.flake8
.gitignore
.isort.cfg
.pylintrc
.readthedocs.yaml
AUTHORS
CONTRIBUTING.rst
Dockerfile
LICENSE
LICENSE.3RDPARTY
MANIFEST.in
Makefile
README.rst
SECURITY.md
build_project.sh
constraints-Django32.txt
constraints-Django4.txt
entrypoint
pyproject.toml
quicktest.py
requirements-dev.txt
requirements-no-pinax.txt
requirements-testing.txt
requirements.txt
setup.py
tox.ini
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
import os
|
|
|
|
from django.db import migrations
|
|
from django.core import serializers
|
|
|
|
fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fixtures'))
|
|
fixture_filename = 'emailtemplate.json'
|
|
|
|
def deserialize_fixture():
|
|
fixture_file = os.path.join(fixture_dir, fixture_filename)
|
|
|
|
with open(fixture_file, 'rb') as fixture:
|
|
return list(serializers.deserialize('json', fixture, ignorenonexistent=True))
|
|
|
|
|
|
def load_fixture(apps, schema_editor):
|
|
objects = deserialize_fixture()
|
|
|
|
for obj in objects:
|
|
obj.save()
|
|
|
|
|
|
def unload_fixture(apps, schema_editor):
|
|
"""Delete all EmailTemplate objects"""
|
|
|
|
objects = deserialize_fixture()
|
|
|
|
EmailTemplate = apps.get_model("helpdesk", "emailtemplate")
|
|
EmailTemplate.objects.filter(pk__in=[ obj.object.pk for obj in objects ]).delete()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('helpdesk', '0002_populate_usersettings'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(load_fixture, reverse_code=unload_fixture),
|
|
]
|