w
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

models.py
text/x-python

Download raw (1.6 KB)

from django.db import models
from django.contrib.postgres.fields import JSONField
from taggit.managers import TaggableManager


class Attachment(models.Model):
    title = models.CharField(max_length=255)
    attachment = models.FileField()


class Score(models.Model):
    """docstring"""

    SCORE_TYPE_CHOICES = (
        (1, "transcription"),
        (2, "prescription"),
        (3, "traduction")
    )

    title = models.CharField(max_length=255)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    score_type = models.PositiveSmallIntegerField(
        default=1, choices=SCORE_TYPE_CHOICES)
    score_author = models.TextField(blank=True)
    performance_author = models.TextField(blank=True)
    presentation = models.TextField(blank=True)
    effectif = JSONField(blank=True)
    stage_set = models.TextField(blank=True)
    duration = models.TextField(blank=True)
    genre = models.TextField(blank=True)
    tags = models.TextField(blank=True)
    tags = TaggableManager()
    mainline = JSONField(blank=True)
    language = models.TextField(blank=True)

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return "/partitions/{}".format(self.id)

    class Meta:
        permissions = (
            ('view_score', 'Can view score'),
        )
        ordering = ['title']


class FeaturedScore(models.Model):
    score = models.ForeignKey(Score)
    order = models.PositiveSmallIntegerField("ordre", default=0, blank=False, null=False)

    class Meta:
        ordering = ("order",)

    def __str__(self):
        return self.score.title