Hidden
@wq/material’s <Hidden/>
input component is entirely invisible, unless there is a validation error specific to the field. Use Hidden
when you want a field to be present in the Serializer output but not in the form.
# myapp/models.py
from django.db import models
class Survey(models.Model):
hidden_field = models.CharField(
max_length=10,
default=somehow_determine_default,
)
# myapp/serializers.py
from wq.db.rest.serializers import ModelSerializer
from rest_framework import serializers
from .models import Survey
class SurveySerializer(ModelSerializer):
class Meta:
model = Survey
fields = '__all__'
wq_field_config = {
'hidden_field': {'control': {'appearance': 'hidden'}},
}
# myapp/rest.py
from .models import Survey
from .serializers import SurveySerializer
rest.router.register_model(
Survey,
serializer=SurveySerializer,
)
Source
While @wq/react defines a placeholder implementation, @wq/material’s versions are more useful as reference: