from rest_framework import serializers
from registries.models import Organization
from gwells.models import ProvinceState

class DrillerListSerializer(serializers.ModelSerializer):
    province_state = serializers.ReadOnlyField()

    class Meta:
        model = Organization

        # Using all fields for now
        fields = (
            #'who_created',
            #'when_created',
            #'who_updated',
            #'when_updated',
            'name',
            'street_address',
            'city',
            'province_state',
            'postal_code',
            'main_tel',
            'fax_tel',
            'website_url',
            'certificate_authority',
        )

from rest_framework import serializers
from registries.models import Organization
from gwells.models import ProvinceState


class DrillerListSerializer(serializers.ModelSerializer):
    """
    Serializer for Driller model "list" view.
    """

    province_state = serializers.ReadOnlyField(source="province_state.code")

    class Meta:
        model = Organization

        # Using all fields for now
        fields = (
            #'who_created',
            #'when_created',
            #'who_updated',
            #'when_updated',
            'org_guid',
            'name',
            'street_address',
            'city',
            'province_state',
            'postal_code',
            'main_tel',
            #'fax_tel',
            #'website_url',
            #'certificate_authority',
        )

Add fields to driller list serializer
Add fields to driller list serializer

  from rest_framework import serializers
  from registries.models import Organization
  from gwells.models import ProvinceState
  
+ 
  class DrillerListSerializer(serializers.ModelSerializer):
+     """
+     Serializer for Driller model "list" view.
+     """
+ 
-     province_state = serializers.ReadOnlyField()
+     province_state = serializers.ReadOnlyField(source="province_state.code")
  
      class Meta:
          model = Organization
  
          # Using all fields for now
          fields = (
              #'who_created',
              #'when_created',
              #'who_updated',
              #'when_updated',
+             'org_guid',
              'name',
              'street_address',
              'city',
              'province_state',
              'postal_code',
              'main_tel',
-             'fax_tel',
+             #'fax_tel',
-             'website_url',
+             #'website_url',
-             'certificate_authority',
+             #'certificate_authority',
          )
  
Add fields to driller list serializer
## Code Before:
from rest_framework import serializers
from registries.models import Organization
from gwells.models import ProvinceState

class DrillerListSerializer(serializers.ModelSerializer):
    province_state = serializers.ReadOnlyField()

    class Meta:
        model = Organization

        # Using all fields for now
        fields = (
            #'who_created',
            #'when_created',
            #'who_updated',
            #'when_updated',
            'name',
            'street_address',
            'city',
            'province_state',
            'postal_code',
            'main_tel',
            'fax_tel',
            'website_url',
            'certificate_authority',
        )

## Instruction:
Add fields to driller list serializer
## Code After:
from rest_framework import serializers
from registries.models import Organization
from gwells.models import ProvinceState


class DrillerListSerializer(serializers.ModelSerializer):
    """
    Serializer for Driller model "list" view.
    """

    province_state = serializers.ReadOnlyField(source="province_state.code")

    class Meta:
        model = Organization

        # Using all fields for now
        fields = (
            #'who_created',
            #'when_created',
            #'who_updated',
            #'when_updated',
            'org_guid',
            'name',
            'street_address',
            'city',
            'province_state',
            'postal_code',
            'main_tel',
            #'fax_tel',
            #'website_url',
            #'certificate_authority',
        )
