From 34af8eb1cb4fbbf53d2a740050a007b6dca478f5 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 5 Sep 2020 13:06:02 +0200
Subject: [PATCH] Turn ontology.models into package

---
 ontology/models/__init__.py                 |  9 ++++++
 ontology/{models.py => models/relations.py} | 35 +--------------------
 ontology/models/tag.py                      | 19 +++++++++++
 ontology/models/topic.py                    | 24 ++++++++++++++
 4 files changed, 53 insertions(+), 34 deletions(-)
 create mode 100644 ontology/models/__init__.py
 rename ontology/{models.py => models/relations.py} (53%)
 create mode 100644 ontology/models/tag.py
 create mode 100644 ontology/models/topic.py

diff --git a/ontology/models/__init__.py b/ontology/models/__init__.py
new file mode 100644
index 000000000..46201bd62
--- /dev/null
+++ b/ontology/models/__init__.py
@@ -0,0 +1,9 @@
+__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
+__license__ = "AGPL v3"
+
+
+from .relations import RelationAsym, RelationSym
+
+from .tag import Tag
+
+from .topic import Topic
diff --git a/ontology/models.py b/ontology/models/relations.py
similarity index 53%
rename from ontology/models.py
rename to ontology/models/relations.py
index ad853e03e..126ab007c 100644
--- a/ontology/models.py
+++ b/ontology/models/relations.py
@@ -3,41 +3,8 @@ __license__ = "AGPL v3"
 
 
 from django.db import models
-from django.urls import reverse
 
-from .constants import TOPIC_RELATIONS_ASYM, TOPIC_RELATIONS_SYM
-
-
-class Tag(models.Model):
-    """
-    Tags can be attached to a Topic to specify which category it fits.
-    Examples: Concept, Device, Model, Theory, ...
-    """
-    name = models.CharField(max_length=32, unique=True)
-
-    class Meta:
-        ordering = ['name']
-
-    def __str__(self):
-        return self.name
-
-
-class Topic(models.Model):
-    """
-    A Topic represents one of the nodes in the ontology.
-    """
-    name = models.CharField(max_length=256, unique=True)
-    slug = models.SlugField(unique=True, allow_unicode=True)
-    tags = models.ManyToManyField('ontology.Tag', blank=True)
-
-    class Meta:
-        ordering = ['name']
-
-    def __str__(self):
-        return self.name
-
-    def get_abolute_url(self):
-        return reverse('ontology:topic_details', kwargs={'slug': self.slug})
+from ..constants import TOPIC_RELATIONS_ASYM, TOPIC_RELATIONS_SYM
 
 
 class RelationAsym(models.Model):
diff --git a/ontology/models/tag.py b/ontology/models/tag.py
new file mode 100644
index 000000000..cb0280c64
--- /dev/null
+++ b/ontology/models/tag.py
@@ -0,0 +1,19 @@
+__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
+__license__ = "AGPL v3"
+
+
+from django.db import models
+
+
+class Tag(models.Model):
+    """
+    Tags can be attached to a Topic to specify which category it fits.
+    Examples: Concept, Device, Model, Theory, ...
+    """
+    name = models.CharField(max_length=32, unique=True)
+
+    class Meta:
+        ordering = ['name']
+
+    def __str__(self):
+        return self.name
diff --git a/ontology/models/topic.py b/ontology/models/topic.py
new file mode 100644
index 000000000..7c6b05017
--- /dev/null
+++ b/ontology/models/topic.py
@@ -0,0 +1,24 @@
+__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
+__license__ = "AGPL v3"
+
+
+from django.db import models
+from django.urls import reverse
+
+
+class Topic(models.Model):
+    """
+    A Topic represents one of the nodes in the ontology.
+    """
+    name = models.CharField(max_length=256, unique=True)
+    slug = models.SlugField(unique=True, allow_unicode=True)
+    tags = models.ManyToManyField('ontology.Tag', blank=True)
+
+    class Meta:
+        ordering = ['name']
+
+    def __str__(self):
+        return self.name
+
+    def get_abolute_url(self):
+        return reverse('ontology:topic_details', kwargs={'slug': self.slug})
-- 
GitLab