Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
xtnctx authored Nov 8, 2022
1 parent 3af1d71 commit 64ffa52
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion bfrbsysAPI/apis/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from rest_framework import serializers
from .models import Item, TrainedModel
from django.contrib.auth.models import User
from rest_framework.validators import UniqueTogetherValidator

class ItemSerializer(serializers.ModelSerializer):
class Meta:
Expand All @@ -9,4 +11,27 @@ class Meta:
class TrainedModelSerializer(serializers.ModelSerializer):
class Meta:
model = TrainedModel
fields = '__all__'
fields = '__all__'



class UserSerializer(serializers.ModelSerializer):
def create(self, validated_data):
user = User.objects.create_user(**validated_data)
return user

class Meta:
model = User
fields = (
'username',
'first_name',
'last_name',
'email',
'password',
)
validators = [
UniqueTogetherValidator(
queryset=User.objects.all(),
fields=['username', 'email']
)
]

0 comments on commit 64ffa52

Please sign in to comment.