Skip to content

Model defaults ignored on empty text field or empty boolean field. #3788

@a1Gupta

Description

@a1Gupta

I am using Django 1.8 and DRF 3.3.1. I am still facing similar issue referenced in #1101.

class UserSetting(models.Model):
    allow_search_by_email = models.BooleanField(default=True)
    allow_profile_indexing = models.BooleanField(('Allow indexing?'), default=True)

class UserSettingSerializer(serializers.ModelSerializer):

    class Meta:
        model = UserPrivacySetting
        fields = [
                    'allow_profile_indexing','allow_search_by_email',
                    ]

But whenever I am posting a blank form, and validating the serializer, it sets false to both the fields.

The issue #1101 was closed in #2311 but I am still facing the similar issue.

Is it fixed ? or
Should i use the workaround using extra_kwargs ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy