Files
web2.0-backend/webapp/models.py
T
2017-06-07 18:00:08 +03:00

71 lines
1.8 KiB
Python

from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class Tag(models.Model):
# ALWAYS USE TRANSLATED NAME!!!
dummyname = models.CharField(max_length=127)
class TagTr(models.Model):
'''
Model containing translations for tags
'''
lang = models.CharField(max_length=2, default='fi')
name = models.CharField(max_length=127)
translation_for = models.ForeignKey('Tag', related_name='translations')
class Info(models.Model):
'''
model containing something showing on some info feed
'''
publish_time = models.DateTimeField(default=timezone.now)
# published_by = models.Foreignkey(User) #<-- TODO create usermodel
tags = models.ManyToManyField(Tag, related_name="news")
class InfoTr(models.Model):
'''
Model containing translations for news
'''
lang = models.CharField(max_length=2, default='fi')
topic = models.CharField(max_length=255)
content = models.TextField()
translation_for = models.ForeignKey('Info', related_name='translations')
class BaseRole(models.Model):
'''
Base model for occupations/roles
'''
name = models.TextField(_('Name'))
is_board = models.BooleanField(_('Board member'))
class PresetRole(BaseRole):
'''
Model representing a preset occupation in the guild
'''
description = models.TextField(_('Description'))
summary = models.TextField(_('Summary'))
class CustomRole(BaseRole):
'''
Model representing a user-specified custom occupation
'''
pass
class Role(PresetRole):
'''
Model representing an active or historical occupation
in an official's history
'''
start_date = models.DateField(_('Start date'))
end_date = models.DateField(_('End date'))