Commit e1c7075f authored by Lukas Burgey's avatar Lukas Burgey

Adapt serializer setup for the group description

parent 6d1c82f4
# Generated by Django 2.1 on 2018-08-21 13:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0008_auto_20180821_1140'),
]
operations = [
migrations.AlterField(
model_name='groupdescription',
name='group',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='description', to='auth.Group'),
),
]
......@@ -4,7 +4,7 @@ from django.db import models
class GroupDescription(models.Model):
group = models.ForeignKey(
group = models.OneToOneField(
Group,
related_name='description',
on_delete=models.CASCADE,
......@@ -14,5 +14,6 @@ class GroupDescription(models.Model):
blank=False,
)
def __str__(self):
return self.group.name + '-description'
......@@ -7,13 +7,26 @@ from rest_framework import serializers
from ... import models
class GroupDescriptionSerializer(serializers.ModelSerializer):
# group = backend_serializers.GroupSerializer()
class Meta:
model = models.GroupDescription
fields = [
# 'group',
'description',
]
class GroupSerializer(serializers.ModelSerializer):
description = GroupDescriptionSerializer()
class Meta:
model = Group
fields = [
'id',
'name',
'description',
]
......
......@@ -3,6 +3,8 @@
from rest_framework import serializers
from django.contrib.auth.models import Group
from ... import models
from .. import serializers as backend_serializers
......
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