More work on score app

This commit is contained in:
Claudio Maggioni (maggicl) 2019-08-07 14:47:24 +02:00
parent b5a133a3c2
commit c7f7ad4f1b
6 changed files with 61 additions and 2 deletions

View file

@ -44,6 +44,7 @@ STATIC_ROOT = "static/"
INSTALLED_APPS = [
'counter.apps.CounterConfig',
'user.apps.UserConfig',
'score.apps.ScoreConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',

View file

@ -22,6 +22,7 @@ from django.views.i18n import JavaScriptCatalog
urlpatterns = i18n_patterns(
path('', include('counter.urls')),
path('', include('score.urls')),
path('admin/', admin.site.urls),
path('accounts/', include('user.urls')),

View file

@ -29,7 +29,7 @@ class Score(models.Model):
class ScoreRow(models.Model):
class Meta:
unique_togheter = ('score', 'end_number')
unique_together = [['score', 'end_number']]
score = models.ForeignKey(Score, on_delete=models.CASCADE)
arrow_list = models.CharField(_('Comma separated list of arrow scores'),

View file

@ -0,0 +1,47 @@
{# vim: set ts=2 sw=2 et tw=80: #}
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Update score" %}{% endblock %}
{% block scripts %}
<script>
$(document).ready(() => {
$('#target-svg').click((e) => console.log(e));
});
</script>
{% endblock %}
{% block style %}
<style>
.target > object {
max-width: 450px;
max-height: 450px;
width: 100%;
height: 100%;
display: inline-block;
margin: 1rem;
}
.target {
text-align: center;
}
</style>
{% endblock %}
{% block content %}
<h1 class="center edit-arrowcount title">{% trans "Update score" %}</h1>
<div class="card-panel grey lighten-1 target">
<object id="target-svg"
type="image/svg+xml" data="{% static "img/WA_target.svg" %}">
</object>
</div>
<div class="card grey lighten-2">
<div class="card-content center">
<span class="card-title">{% trans "Score" %}</span>
<p>lorem</p>
</div>
</div>
{% endblock %}

7
score/urls.py Normal file
View file

@ -0,0 +1,7 @@
from django.urls import path
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
path('score/edit/<int:sc_id>', views.score_edit, name='score_edit'),
]

View file

@ -1,3 +1,6 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required
def score_edit(request, sc_id):
return render(request, 'score/edit.html', {})