SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 34af8eb1 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Turn ontology.models into package

parent 2d3a1571
No related branches found
No related tags found
No related merge requests found
__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
from .relations import RelationAsym, RelationSym
from .tag import Tag
from .topic import Topic
......@@ -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):
......
__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
__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})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment