Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
e1c7075f
Commit
e1c7075f
authored
Aug 21, 2018
by
Lukas Burgey
Browse files
Adapt serializer setup for the group description
parent
6d1c82f4
Changes
4
Hide whitespace changes
Inline
Side-by-side
feudal/backend/migrations/0009_auto_20180821_1529.py
0 → 100644
View file @
e1c7075f
# 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'
),
),
]
feudal/backend/models/groups.py
View file @
e1c7075f
...
...
@@ -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'
feudal/backend/models/serializers/__init__.py
View file @
e1c7075f
...
...
@@ -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'
,
]
...
...
feudal/backend/models/serializers/webpage.py
View file @
e1c7075f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment