Commit ea5ace6e75e9be5436831f84ee2f8908479d32e3
Exists in
master
Merge branch 'master' of https://git.ucsd.edu/110swag/flashy-backend
Added email confirmation in api.py under PATCH
Showing 1 changed file Inline Diff
flashcards/serializers.py
View file @
ea5ace6
from flashcards.models import Section, LecturePeriod, User | 1 | 1 | from flashcards.models import Section, LecturePeriod, User | |
from rest_framework.fields import EmailField | 2 | 2 | from rest_framework.fields import EmailField | |
from rest_framework.relations import HyperlinkedRelatedField | 3 | 3 | from rest_framework.relations import HyperlinkedRelatedField | |
from rest_framework.serializers import HyperlinkedModelSerializer | 4 | 4 | from rest_framework.serializers import HyperlinkedModelSerializer | |
5 | 5 | |||
6 | 6 | |||
class SectionSerializer(HyperlinkedModelSerializer): | 7 | 7 | class SectionSerializer(HyperlinkedModelSerializer): | |
lectureperiod_set = HyperlinkedRelatedField(many=True, view_name='lectureperiod-detail', read_only=True) | 8 | 8 | lectureperiod_set = HyperlinkedRelatedField(many=True, view_name='lectureperiod-detail', read_only=True) | |
9 | 9 | |||
class Meta: | 10 | 10 | class Meta: | |
model = Section | 11 | 11 | model = Section | |
exclude = ('members',) | 12 | 12 | # exclude = ('members',) | |
13 | 13 | |||
14 | 14 | |||
class LecturePeriodSerializer(HyperlinkedModelSerializer): | 15 | 15 | class LecturePeriodSerializer(HyperlinkedModelSerializer): | |
class Meta: | 16 | 16 | class Meta: | |
model = LecturePeriod | 17 | 17 | model = LecturePeriod | |
18 | 18 | |||
19 | 19 | |||
class UserSerializer(HyperlinkedModelSerializer): | 20 | 20 | class UserSerializer(HyperlinkedModelSerializer): |