Commit ce8b67a0 authored by Robert's avatar Robert

Add basic series api endpoint

parent 1ccb3e23
Pipeline #1526 failed with stage
in 1 minute and 48 seconds
# Generated by Django 2.1.7 on 2019-03-28 10:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('audiothek', '0047_auto_20190328_1040'),
]
operations = [
migrations.AlterField(
model_name='moderationsequencesystemitem',
name='audiofile',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='audiothek.Audiofile'),
),
]
# Generated by Django 2.1.7 on 2019-03-28 10:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('audiothek', '0048_auto_20190328_1114'),
]
operations = [
migrations.AlterField(
model_name='moderationsequencesystemitem',
name='audiofile',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='audiothek.Audiofile'),
),
]
# Generated by Django 2.1.7 on 2019-03-28 10:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('audiothek', '0049_auto_20190328_1123'),
]
operations = [
migrations.AlterField(
model_name='moderationsequencesystemitem',
name='audiofile',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='audiothek.Audiofile'),
),
]
# Generated by Django 2.1.7 on 2019-03-28 10:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('program', '0023_auto_20190322_1159'),
]
operations = [
migrations.AddField(
model_name='radioprogram',
name='cover_image',
field=models.ImageField(blank=True, upload_to=''),
),
migrations.AddField(
model_name='radioprogram',
name='teaser',
field=models.CharField(blank=True, max_length=180),
),
migrations.AlterField(
model_name='radioprogram',
name='name',
field=models.CharField(max_length=100),
),
]
......@@ -25,8 +25,10 @@ class Broadcast(models.Model):
class RadioProgram(models.Model):
name = models.CharField(max_length=255)
name = models.CharField(max_length=100)
description = models.TextField(max_length=3000, blank=True)
teaser = models.CharField(max_length=180, blank=True)
cover_image = models.ImageField(blank=True)
class Meta:
ordering = ('name',)
......
from rest_framework import serializers
from audiothek.models import RadioReport
from program.models import RadioProgram
class ProgramSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = RadioProgram
fields = ('id', 'name', 'description', 'teaser', 'cover_image',)
class ReportSerializer(serializers.HyperlinkedModelSerializer):
......
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from rest_api.frontend.views import ReportViewSet
from rest_api.frontend.views import ProgramViewSet, ReportViewSet
router = DefaultRouter()
router.register(r'reports', ReportViewSet)
router.register(r'recordings', ReportViewSet)
router.register(r'series', ProgramViewSet)
urlpatterns = [
path('', include(router.urls)),
......
from rest_framework import viewsets
from audiothek.models import RadioReport
from audiothek.serializers import ReportSerializer
from program.models import RadioProgram
from rest_api.frontend.serializers import ProgramSerializer, ReportSerializer
class ProgramViewSet(viewsets.ReadOnlyModelViewSet):
queryset = RadioProgram.objects.all()
serializer_class = ProgramSerializer
class ReportViewSet(viewsets.ReadOnlyModelViewSet):
......
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