Compare commits
4 Commits
147c84550c
...
4d964291b2
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d964291b2 | |||
| ee5305ba6c | |||
|
|
02858a76c0 | ||
|
|
1bcec919cf |
@ -55,4 +55,4 @@
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@ -43,13 +43,13 @@ class Orchestration(models.Model):
|
||||
def as_list(self):
|
||||
tags = [ t.strip() for t in self.instruments.split(' ') ]
|
||||
return [ (t, MusicTag.from_tag(t)) for t in tags if t ]
|
||||
|
||||
|
||||
def tag_order(self):
|
||||
tags = [ t.strip() for t in self.instruments.split(' ') if t ]
|
||||
order = {'score': 0}
|
||||
for i, t in enumerate(tags):
|
||||
order.setdefault(t.strip('-0123456789'), i*2+1)
|
||||
|
||||
|
||||
return order
|
||||
|
||||
def sorter(self):
|
||||
@ -78,14 +78,13 @@ class ProjectItem(models.Model):
|
||||
approved_by = models.ForeignKey('auth.User', on_delete=models.CASCADE)
|
||||
order = models.SmallIntegerField(default=0)
|
||||
section = models.CharField(max_length=100, blank=True)
|
||||
|
||||
|
||||
class Meta:
|
||||
ordering = ['order', 'work']
|
||||
|
||||
def __str__(self):
|
||||
return f"<{self.project_id}:{slugify(self.work.name)}>"
|
||||
|
||||
|
||||
class Collection(models.Model):
|
||||
"""
|
||||
A logical collection of works, typically owned by an organisation or person (physical or virtual)
|
||||
@ -94,13 +93,13 @@ class Collection(models.Model):
|
||||
help_text="Name of the collection")
|
||||
prefix = models.CharField(max_length=255, default="default",
|
||||
help_text="Folder to store works in")
|
||||
administrators = models.ManyToManyField('auth.User', related_name="collections",
|
||||
administrators = models.ManyToManyField('auth.User', related_name="collections",
|
||||
help_text="Administrators for this collection")
|
||||
location = models.CharField(max_length=100,
|
||||
location = models.CharField(max_length=100,
|
||||
help_text="Physical location (institution, town...)", blank=True)
|
||||
storage = models.ForeignKey('byostorage.UserStorage', on_delete=models.CASCADE, null=True, blank=True,
|
||||
storage = models.ForeignKey('byostorage.UserStorage', on_delete=models.CASCADE, null=True, blank=True,
|
||||
help_text="User storage for documents")
|
||||
notes = models.TextField(blank=True,
|
||||
notes = models.TextField(blank=True,
|
||||
help_text="Publicly visible notes about collection and loans policy (markdown format)")
|
||||
settings = models.JSONField(default=dict, blank=True,
|
||||
help_text="Storage specific settings")
|
||||
@ -117,8 +116,8 @@ class Collection(models.Model):
|
||||
|
||||
@property
|
||||
def genres(self):
|
||||
return self.meta('genre')
|
||||
|
||||
return self.meta('genre')
|
||||
|
||||
def has_administrator(self, user):
|
||||
if not user.is_authenticated:
|
||||
return False
|
||||
@ -131,7 +130,7 @@ class Collection(models.Model):
|
||||
|
||||
def auth(self):
|
||||
return sign_data(f'{self.pk}-{self.nonce}', 12)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@ -175,7 +174,7 @@ class Work(models.Model):
|
||||
(LICENCE_PERUSAL, 'Perusal Licence'),
|
||||
(LICENCE_NONE, 'Internal use only'),
|
||||
)
|
||||
|
||||
|
||||
name = models.CharField(max_length=255, help_text="Original name of the work")
|
||||
edition = models.CharField(max_length=255, blank=True,
|
||||
help_text="Edition details to distinguish multiple versions")
|
||||
@ -192,7 +191,7 @@ class Work(models.Model):
|
||||
code = models.CharField(max_length=100, blank=True, help_text="Collection specific code or number. Will be auto-generated if not supplied")
|
||||
licence = models.PositiveSmallIntegerField(choices=LICENCE_TYPES, default=6, help_text="Copyright status")
|
||||
max_projects = models.IntegerField(default=1, help_text="How many active projects can this work be attached to")
|
||||
|
||||
|
||||
# Extra info
|
||||
running_time = models.DurationField(null=True, blank=True, help_text="Running time in mm:ss format")
|
||||
notes = models.TextField(blank=True)
|
||||
@ -220,7 +219,7 @@ class Work(models.Model):
|
||||
#return [ s[1] for s in sections ]
|
||||
sections = list(dict(sections).items()) # primitive unique()
|
||||
return sections
|
||||
|
||||
|
||||
def pdfs(self):
|
||||
return self.docs.filter(doctype=Document.DOCTYPE_PDF)
|
||||
|
||||
@ -305,7 +304,7 @@ class WorkMeta(models.Model):
|
||||
('style', 'Style'),
|
||||
('orchestration', 'Orchestration'),
|
||||
)
|
||||
|
||||
|
||||
work = models.ForeignKey(Work, on_delete=models.CASCADE, related_name='meta_info')
|
||||
name = models.SlugField(max_length=20, choices=META_CHOICES)
|
||||
value = models.CharField(max_length=255)
|
||||
@ -349,7 +348,7 @@ class Document(models.Model):
|
||||
def delete(self, *args, **kwargs):
|
||||
self.upload.delete(save=False)
|
||||
return super().delete(*args, **kwargs)
|
||||
|
||||
|
||||
def filename(self):
|
||||
return os.path.basename(self.upload.name)
|
||||
|
||||
@ -360,7 +359,7 @@ class Section(models.Model):
|
||||
"""
|
||||
Section is a tagged portion of a Document
|
||||
"""
|
||||
|
||||
|
||||
PAGE_AUTO = 0
|
||||
PAGE_LEFT = 1
|
||||
PAGE_RIGHT = 2
|
||||
@ -397,7 +396,7 @@ class Section(models.Model):
|
||||
def filename(self):
|
||||
return slugify(f'{self.doc.work.name} - {self.name}').title() + '.pdf'
|
||||
|
||||
@property
|
||||
@property
|
||||
def pagerange(self):
|
||||
if self.start:
|
||||
if self.end:
|
||||
@ -407,3 +406,4 @@ class Section(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
@ -12,14 +12,18 @@ dependencies = [
|
||||
"django-crispy-forms",
|
||||
"django-markdown2",
|
||||
"django-rest-framework",
|
||||
"crispy-bulma (>=0.12.0,<0.13.0)"
|
||||
"crispy-bulma (>=0.12.0,<0.13.0)",
|
||||
"django-byostorage @ git+https://gitea.tfconsulting.com.au/tris/django-byostorage.git@9903bb00888f20dfd2d39754e5ee22eeb5f36298",
|
||||
"requests (>=2.32.5,<3.0.0)",
|
||||
"django-storages (>=1.14.6,<2.0.0)",
|
||||
"boto3 (>=1.40.20,<2.0.0)"
|
||||
]
|
||||
|
||||
[tool.poetry]
|
||||
packages = [{include = "*", from="app"}]
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
django-debug-toolbar = "3.8.1"
|
||||
django-debug-toolbar = "5.2"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user