models.py
1.02 KB
from django.db import models
class Example(models.Model):
entry = models.ForeignKey('connections.Entry', related_name='examples', on_delete=models.PROTECT)
sentence = models.TextField()
opinion = models.ForeignKey('ExampleOpinion', related_name='examples', on_delete=models.PROTECT)
source = models.ForeignKey('ExampleSource', related_name='examples', on_delete=models.PROTECT)
note = models.TextField(null=True)
def __str__(self):
return self.sentence
class ExampleOpinion(models.Model):
key = models.CharField(max_length=16, unique=True)
# name = TODO: wymaga lokalizacji
priority = models.PositiveIntegerField()
class Meta:
ordering = ['priority']
def __unicode__(self):
return self.key
class ExampleSource(models.Model):
key = models.CharField(max_length=64, unique=True)
# name = TODO: wymaga lokalizacji
priority = models.PositiveIntegerField()
class Meta:
ordering = ['priority']
def __str__(self):
return self.key