Hooked up library app

This commit is contained in:
Tris 2021-03-11 09:33:51 +11:00
parent 526ae4f59b
commit 35555c3321
13 changed files with 103 additions and 9 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ polyphonic/settings.py
env
test.*
static
teststore
teststore
cache

View File

@ -1,7 +1,5 @@
from django.contrib import admin
# Register your models here.
from . import models
class EnsembleAdmin(admin.ModelAdmin):

View File

@ -0,0 +1,34 @@
# Generated by Django 3.1.1 on 2021-03-03 09:43
from django.db import migrations, models
from django.utils.text import slugify
def create_slugs(apps, schema_editor):
for model in ('Ensemble', 'Project'):
M = apps.get_model('interface', model)
for instance in M.objects.all():
if instance.slug == '':
instance.slug = slugify(instance.name)
instance.save()
class Migration(migrations.Migration):
dependencies = [
('interface', '0021_project_description'),
]
operations = [
migrations.AddField(
model_name='ensemble',
name='slug',
field=models.SlugField(default='', editable=False, max_length=100),
preserve_default=False,
),
migrations.AddField(
model_name='project',
name='slug',
field=models.SlugField(default='', editable=False, max_length=100),
preserve_default=False,
),
migrations.RunPython(create_slugs)
]

View File

@ -153,6 +153,14 @@ INPUT[type=checkbox] {
color: white;
}
.clickable {
cursor: pointer;
}
.action {
margin: 0px 10px 0px 5px;
}
.pills {
display: flex;
flex-wrap: wrap;
@ -238,6 +246,10 @@ TABLE.horizontal TH {
padding: 5px;
}
TABLE SELECT {
width: 100%;
}
.resource-player {
width: 100%;
border-radius: 10px;
@ -276,4 +288,32 @@ TABLE.horizontal TH {
width: 200px !important;
margin-left: -100px !important;
margin-top: 24px !important;
}
.item-table {
border-collapse: collapse;
}
.item-table TD {
border: 1px solid #999;
}
TD.select-cell {
padding: 0;
}
.select-cell SELECT {
border: none;
background-color: white;
height: 30px;
font-family: inherit;
font-size: inherit;
}
#tag-list DIV {
padding: 5px;
}
DIV.selected {
background-color: #EEE;
border: 1px solid #999;
border-radius: 5px;
}

View File

@ -16,7 +16,7 @@
<nav class="navigation">
<div>
<a class="brand" href="/"><i class="fas fa-random smhide"></i> Polyphonic</a>
<span class="mdhide">Virtual Ensemble Manager</span>
<span class="mdhide">Ensemble Manager</span>
</div>
<ul class="nav-buttons">
{% if request.ensemble_id %}
@ -25,7 +25,7 @@
Projects</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'register' %}"><i class="fas fa-users" title="Ensembles"></i> <span class="smhide">My
<a class="nav-link" href="{% url 'register' %}"><i class="fas fa-users" title="Ensembles"></i> <span class="mdhide">My
Ensembles</span></a>
</li>
{% endif %}

View File

@ -3,7 +3,7 @@
{% block page %}
<div>
<h3>{{ title }}</h3>
<form class="vertical" method="POST">
<form class="vertical" method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<div class="form-actions">

View File

@ -7,7 +7,11 @@
{% for project in ensemble.active_projects %}
<a class="" href="{% url 'project_detail' pk=project.id %}">
<h3>{{ project.name }}</h3>
<p><small>Due in {{ project.deadline|timeuntil }}, {{ project.submissions.count }} submissions.</small></p>
<p><small>
{% if project.deadline %}In {{ project.deadline|timeuntil }}<br/>{% endif %}
{% if project.works.count %}{{ project.works.count }} works<br/>{% endif %}
{% if project.submissions.count %}{{ project.submissions.count }} submissions<br/>{% endif %}
</small></p>
</a>
{% endfor %}
</div>

View File

@ -8,6 +8,9 @@
URL: <a href="{{ ensemble_url }}">{{ ensemble_url }}</a><br/>
Passphrase: {{ ensemble.passphrase }}
</p>
<ul>
<li><a href="{% url 'work_list' %}">Library</a></li>
</ul>
<p>
Sorry, not much you can do here yet.
<ul>

View File

@ -13,6 +13,7 @@
{% block page %}
No content
{% endblock %}
{% if project %}
<div class="project-links">
<div class="pills" role="tablist">
<a role="tab" href="{% url 'project_detail' pk=project.id %}">Project info</a>
@ -26,6 +27,8 @@ No content
<a role="tab" href="{% url 'submission_list' project=project.id %}">Submissions</a>
{% endif %}
<a role="tab" href="{% url 'submission_create' project=project.id %}">Send a file</a>
{% include "library/project_menu.html" %}
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -4,7 +4,9 @@
{% block page %}
<div class="narrow">
<h3 class="text-center">Due in {{ project.deadline|timeuntil }}!</h3>
{% if project.deadline %}
<h3 class="text-center">In {{ project.deadline|timeuntil }}</h3>
{% endif %}
<p>{{ project.description|markdown }}</p>
{% if project.owner %}
<p>Project email: <a href="mailto:{{ project.owner }}">{{ project.owner }}</a></p>

View File

@ -372,7 +372,6 @@ class ResourceCreateView(ProjectMixin, CreateView):
admin_required = True
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.project = self.get_project()
self.object.save()

View File

@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'django_markdown2',
'interface',
'library',
]
MIDDLEWARE = [
@ -123,3 +124,5 @@ STATIC_URL = '/static/'
# Need to set this
AWS_BUCKET = ''
MEDIA_ROOT = 'media'

View File

@ -19,4 +19,11 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('interface.urls')),
path('', include('library.urls')),
]
try:
import debug_toolbar
urlpatterns.append(path('__debug__', include(debug_toolbar.urls)))
except ImportError:
pass