[Answered ]-Adding a custom field to Django Mezzanine blog post

2👍

✅

If anyone comes into similar issues,

EXTRA_MODEL_FIELDS = (
  (
    "mezzanine.pages.models.BlogPost.caption",
    "CharField",
    ("Caption",),
    {"blank": True, 'max_length': 150},
  ),
)

is erroneous, and should be

EXTRA_MODEL_FIELDS = (
  (
    "mezzanine.blog.models.BlogPost.caption",
    "django.db.models.CharField",
    ("Caption",),
    {"default": 'Some String', 'max_length': 150},
  ),
)

Running makemigrations from there generates it as expected.

Leave a comment