models.py 779 Bytes
# -*- coding: utf-8 -*-
from django.db.models import Model, CharField, IntegerField, ForeignKey


class InflectionType(Model):
    symbol = CharField(primary_key=True, max_length=16, db_column='czm')
    color_scheme = IntegerField()
    full_name = CharField(max_length=128)

    def __unicode__(self):
        return self.symbol

    class Meta:
        db_table = 'czescimowy'


class BaseFormLabel(Model):
    symbol = CharField(max_length=32, blank=True, db_column='efobaz')
    lexical_class = ForeignKey(InflectionType)
    index = IntegerField()

    def __unicode__(self):
        return '%s/%s' % (self.symbol, self.lexical_class.symbol)

    class Meta:
        db_table = 'efobazy'
        unique_together = ['symbol', 'lexical_class']
        ordering = ['index']