Skip to content

NameError: Slugify not imported in model.py in utils app #94

@OluwagbeminiyiA

Description

@OluwagbeminiyiA

Issue summary

While looking at the code, I noticed slugify wasn't imported and after trying to run the code, it returned a NameError in utils/models.py.

Traceback

File "models.py", line 157, in slugify
title = slugify(title, allow_unicode=True)
^^^^^^^
NameError: name 'slugify' is not defined. Did you mean: 'self.slugify'

Steps to reproduce

  1. run python manage.py shell
  2. from [your_app.utils].models import ArticleTopic
  3. ArticleTopic(title="test").save()

Additional information

No response

Can be reproduced

Yes, on a fresh Wagtail project

Technical details

Working on this

I can confirm this reproducible on a fresh wagtail news template project. Running the ArticleTopic(title="test").save produces a NameError and I would like to fix this by adding the missing import. I'd submit a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomponent:RoutingURL routing, route resolution, path generation, URL patterns, slug handling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions