Files
customerTicket/apps/core/production_seed.py
T

50 lines
1.2 KiB
Python

import hashlib
from pathlib import Path
SEED_MODEL_LABELS = (
"core.SiteBranding",
"core.PageTitle",
"auth.Group",
"accounts.User",
"staff.OrganizationalUnit",
"customers.ContactGroup",
"customers.CustomerProfile",
"staff.UnitMembership",
"staff.StaffProfile",
"tickets.TicketCategory",
"tickets.SLAConfig",
"tickets.TicketTag",
"tickets.GroupDispatch",
"tickets.DispatchResponseControl",
"tickets.Ticket",
"tickets.TicketAccessGrant",
"tickets.TicketEvent",
"messaging.Message",
"messaging.MessageRevision",
"messaging.MessageMention",
"messaging.MessageReadReceipt",
"tickets.TicketReadState",
"attachments.AttachmentPolicy",
"attachments.Attachment",
"notifications.SMSTemplate",
"notifications.NotificationPolicy",
)
EXCLUDED_VOLATILE_MODELS = (
"admin.LogEntry",
"sessions.Session",
"accounts.OTPChallenge",
"accounts.TicketMagicLink",
"accounts.MagicLinkAccessLog",
"notifications.NotificationJob",
)
def sha256_file(path):
digest = hashlib.sha256()
with Path(path).open("rb") as stream:
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()