Closed Vayel closed 7 years ago
@BurkovBA can I help here?
I'm actually surprised that this is happening - it shouldn't. Here is parsing of help_text
argument: https://github.com/umutbozkurt/django-rest-framework-mongoengine/blob/master/rest_framework_mongoengine/utils.py#L125.
If you could create a unit-test, confirming this issue, it would be very nice, thank you!
For instance, you could modify either test_basic or test_compound, adding help_text
argument to one of the fields:
Indeed, it works. I am sorry, I redefined the field in my serializer so the attributes of the model were not used. To remedy that, I used extra_kwargs
instead of redefinition:
class Collection(Document):
posts = fields.MapField(
fields.EmbeddedDocumentField('Post'),
blank=True,
help_text='Help!',
)
class CollectionSerializer(mongoserializers.DocumentSerializer):
# Before:
# posts = mongofields.DictField(child=PostSerializer())
class Meta:
model = models.Collection
fields = '__all__'
extra_kwargs = {
'posts': {
'child': PostSerializer(),
'validators': [validate_posts_dict],
}
}
Probably the same problem than #224. I have this model:
On the API, the help text does not appear whereas it does with a
StringField
for instance.The help text does appear when I add it into
extra_kwargs
:Thanks!