model-bakers/model_bakery

TypeError: field fieldName TypeError

NawafSwe opened this issue · 2 comments

Issue description:

Hello, I am facing an error while using the model baker with a model that has a RichTextField type,
it gives me an error attached below:
Screenshot 2022-12-08 at 1 57 39 PM

Class Example:

from ckeditor.fields import RichTextField
from django.db import models

class Post(models.Model):
description = RichTextField()
description_ar = RichTextField()

Baker Test:

from model_bakery import baker
post = baker.make(Post,description="ABC",description_ar="ABC" )

Hi, thanks for using model-bakery. As explained in the docs, model bakery only support Django fields. You're trying to use it with a custom field (RichTextField) from a third party library (ckeditor), thus, model-bakery won't work out of the box.

If want to, you can define your own function to generate values for this field type and configure model-bakery to use it. Here are the instructions on how to do so.

Closing this issue since this is not a bug.

Thank you very much.