from django.db.models import fields
from rest_framework import serializers
from .models import Business, NeighbourHood, Post, Profile, User


class NeighbourhoodSerializer(serializers.ModelSerializer):


    class Meta:
        model = NeighbourHood
        fields = '__all__'


class BusinessSerializer(serializers.ModelSerializer):


    class Meta:
        model = Business
        fields = '__all__'


class ProfileSerializer(serializers.ModelSerializer):


    class Meta:
        model = Profile
        fields = '__all__'


class PostSerializer(serializers.ModelSerializer):


    class Meta:
        model = Post
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):


    class Meta:
        model = User
        fields = ['email', 'username', 'password', 'neighbourhood']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(email=validated_data['email'], username=validated_data[
            'username'])
        user.set_password(validated_data['password'])
        user.save()
        return user

8813fad47bd81d22162a51fdc20b252ddf45171d
<mask token>


class PostSerializer(serializers.ModelSerializer):


    class Meta:
        model = Post
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):


    class Meta:
        model = User
        fields = ['email', 'username', 'password', 'neighbourhood']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(email=validated_data['email'], username=validated_data[
            'username'])
        user.set_password(validated_data['password'])
        user.save()
        return user

<mask token>


class ProfileSerializer(serializers.ModelSerializer):


    class Meta:
        model = Profile
        fields = '__all__'


class PostSerializer(serializers.ModelSerializer):


    class Meta:
        model = Post
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):


    class Meta:
        model = User
        fields = ['email', 'username', 'password', 'neighbourhood']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(email=validated_data['email'], username=validated_data[
            'username'])
        user.set_password(validated_data['password'])
        user.save()
        return user

<mask token>


class BusinessSerializer(serializers.ModelSerializer):


    class Meta:
        model = Business
        fields = '__all__'


class ProfileSerializer(serializers.ModelSerializer):


    class Meta:
        model = Profile
        fields = '__all__'


class PostSerializer(serializers.ModelSerializer):


    class Meta:
        model = Post
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):


    class Meta:
        model = User
        fields = ['email', 'username', 'password', 'neighbourhood']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(email=validated_data['email'], username=validated_data[
            'username'])
        user.set_password(validated_data['password'])
        user.save()
        return user

from django.db.models import fields
from rest_framework import serializers
from .models import Business, NeighbourHood, Post, Profile, User


class NeighbourhoodSerializer(serializers.ModelSerializer):


    class Meta:
        model = NeighbourHood
        fields = '__all__'


class BusinessSerializer(serializers.ModelSerializer):


    class Meta:
        model = Business
        fields = '__all__'


class ProfileSerializer(serializers.ModelSerializer):


    class Meta:
        model = Profile
        fields = '__all__'


class PostSerializer(serializers.ModelSerializer):


    class Meta:
        model = Post
        fields = '__all__'


class UserSerializer(serializers.ModelSerializer):


    class Meta:
        model = User
        fields = ['email', 'username', 'password', 'neighbourhood']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(email=validated_data['email'], username=validated_data[
            'username'])
        user.set_password(validated_data['password'])
        user.save()
        return user
