Commit 036bca78 authored by nicolas's avatar nicolas

Merge branch 'master' of gitlab.constantvzw.org:osp/work.w

Conflicts:
	.gitignore
parents d97301cb b07a3153
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,8 +19,12 @@ ALLOWED_HOSTS = []
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'dbname',
'USER': 'username',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
......
LOCAL_SETTINGS = True
from .settings import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_gs%q+2!)n#^33k45wie13vtxj7yv)zu8zhekz)p*i4gs*p*8%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
......@@ -21,7 +21,6 @@ from playground import views
router = routers.DefaultRouter()
router.register(r'axis', views.AxisViewSet)
router.register(r'scores', views.ScoreViewSet)
......
from django.contrib import admin
from .models import Axis, Score
class AxisAdmin(admin.ModelAdmin):
pass
from .models import Score
class ScoreAdmin(admin.ModelAdmin):
pass
admin.site.register(Axis, AxisAdmin)
admin.site.register(Score, ScoreAdmin)
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-22 13:34
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('playground', '0004_auto_20170502_1009'),
]
operations = [
migrations.AddField(
model_name='score',
name='body',
field=django.contrib.postgres.fields.jsonb.JSONField(default={}),
preserve_default=False,
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-22 14:04
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('playground', '0005_score_body'),
]
operations = [
migrations.RemoveField(
model_name='axis',
name='children',
),
migrations.RemoveField(
model_name='score',
name='body',
),
migrations.RemoveField(
model_name='score',
name='child',
),
migrations.AddField(
model_name='score',
name='mainline',
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default='{}'),
preserve_default=False,
),
migrations.AddField(
model_name='score',
name='stage_set',
field=models.TextField(blank=True),
),
migrations.DeleteModel(
name='Axis',
),
]
from django.db import models
class Axis(models.Model):
"""docstring"""
title = models.TextField(blank=True)
children = models.ManyToManyField("Axis", blank=True, null=True)
def __str__(self):
return self.title
from django.contrib.postgres.fields import JSONField
class Score(models.Model):
"""docstring"""
title = models.TextField(blank=True)
child = models.ForeignKey(Axis, blank=True, null=True)
stage_set = models.TextField(blank=True)
mainline = JSONField(blank=True)
def __str__(self):
return self.title
from .models import Axis, Score
from .models import Score
from rest_framework import serializers
from rest_framework_recursive.fields import RecursiveField
class AxisSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.ReadOnlyField()
children = RecursiveField(required=False, allow_null=True, many=True)
class Meta:
model = Axis
fields = ('id', 'title', 'children')
class ScoreSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.ReadOnlyField()
child = AxisSerializer()
class Meta:
model = Score
fields = ('id', 'title', 'child')
fields = ('id', 'title', 'stage_set', 'mainline')
......@@ -57,7 +57,7 @@ li li {
.axis-title .options,
.axis-title .handle {
/*display: none; */
display: inline-block;
display: inline-block;
}
/*.axis-title:hover .options,
......
This diff is collapsed.
......@@ -10,13 +10,13 @@
<link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css">
<link rel="stylesheet" href="{% static 'playground/css/styles.css' %}">
<script id="score-template" type="text/template">
<header>
<h1><%- title %></h1>
<div><%= mise %></div>
</header>
<ol></ol>
</script>
<script id="score-template" type="text/template">
<header>
<h1><%- title %></h1>
<div><%= stage_set %></div>
</header>
<ol></ol>
</script>
<script id="node-template" type="text/template">
<div class="axis-title" tabindex="0">
......@@ -73,7 +73,7 @@
</div>
</div>
<% if (children.length) { %>
<% if (sublines.length) { %>
<ol></ol>
<% } %>
</script>
......
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from rest_framework import viewsets
from .models import Axis, Score
from .serializers import AxisSerializer, ScoreSerializer
from .models import Score
from .serializers import ScoreSerializer
class ScoreViewSet(viewsets.ModelViewSet):
......@@ -13,14 +13,6 @@ class ScoreViewSet(viewsets.ModelViewSet):
serializer_class = ScoreSerializer
class AxisViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = Axis.objects.all()
serializer_class = AxisSerializer
class ScoreDetailView(DetailView):
"""
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment