From 74254455089c496a73b57b2db3c10ddcffebbea6 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Wed, 14 Jun 2023 10:32:15 +0200
Subject: [PATCH] move proofs repo constants inside model

---
 scipost_django/production/constants.py | 13 -------------
 scipost_django/production/models.py    | 20 +++++++++++++++++---
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/scipost_django/production/constants.py b/scipost_django/production/constants.py
index 917a3b852..556a5ee61 100644
--- a/scipost_django/production/constants.py
+++ b/scipost_django/production/constants.py
@@ -74,16 +74,3 @@ PRODUCTION_ALL_WORK_LOG_TYPES = (
         "Cited people have been notified/invited to SciPost",
     ),
 )
-
-PROOFS_REPO_UNINITIALIZED = "uninitialized"
-PROOFS_REPO_CREATED = "created"
-PROOFS_REPO_TEMPLATE_ONLY = "template_only"
-PROOFS_REPO_TEMPLATE_FORMATTED = "template_formatted"
-PROOFS_REPO_PRODUCTION_READY = "production_ready"
-PROOFS_REPO_STATUSES = (
-    (PROOFS_REPO_UNINITIALIZED, "The repository does not exist"),
-    (PROOFS_REPO_CREATED, "The repository exists but is empty"),
-    (PROOFS_REPO_TEMPLATE_ONLY, "The repository contains the bare template"),
-    (PROOFS_REPO_TEMPLATE_FORMATTED, "The repository contains the automatically formatted template"),
-    (PROOFS_REPO_PRODUCTION_READY, "The repository is ready for production"),
-)
diff --git a/scipost_django/production/models.py b/scipost_django/production/models.py
index adb361346..e168ea5a5 100644
--- a/scipost_django/production/models.py
+++ b/scipost_django/production/models.py
@@ -24,8 +24,6 @@ from .constants import (
     PRODUCTION_STREAM_COMPLETED,
     PROOFS_STATUSES,
     PROOFS_UPLOADED,
-    PROOFS_REPO_STATUSES,
-    PROOFS_REPO_UNINITIALIZED,
 )
 from .managers import (
     ProductionStreamQuerySet,
@@ -246,6 +244,22 @@ class ProofsRepository(models.Model):
     ProofsRepository is a GitLab repository of Proofs for a Submission.
     """
 
+    PROOFS_REPO_UNINITIALIZED = "uninitialized"
+    PROOFS_REPO_CREATED = "created"
+    PROOFS_REPO_TEMPLATE_ONLY = "template_only"
+    PROOFS_REPO_TEMPLATE_FORMATTED = "template_formatted"
+    PROOFS_REPO_PRODUCTION_READY = "production_ready"
+    PROOFS_REPO_STATUSES = (
+        (PROOFS_REPO_UNINITIALIZED, "The repository does not exist"),
+        (PROOFS_REPO_CREATED, "The repository exists but is empty"),
+        (PROOFS_REPO_TEMPLATE_ONLY, "The repository contains the bare template"),
+        (
+            PROOFS_REPO_TEMPLATE_FORMATTED,
+            "The repository contains the automatically formatted template",
+        ),
+        (PROOFS_REPO_PRODUCTION_READY, "The repository is ready for production"),
+    )
+
     stream = models.OneToOneField(
         ProductionStream,
         on_delete=models.CASCADE,
@@ -371,7 +385,7 @@ def production_stream_create_proofs_repo(sender, instance, created, **kwargs):
     if created:
         ProofsRepository.objects.create(
             stream=instance,
-            status=PROOFS_REPO_UNINITIALIZED,
+            status=ProofsRepository.PROOFS_REPO_UNINITIALIZED,
         )
 
 
-- 
GitLab