Skip to content

fix: support new factory-boy v3 import alias #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-user-defined-fields"
version = "0.0.21"
version = "0.0.22"
description = "A Django app for user defined fields"
authors = ["Aidan Lister <aidan@uptickhq.com>"]
license = "MIT"
Expand Down
7 changes: 6 additions & 1 deletion userdefinedfields/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
sys.stderr.write("Use of factories requires factory_boy\n")
exit(1)

try:
from factory.django import DjangoModelFactory
except ImportError:
from factory import DjangoModelFactory

from django.utils.text import slugify

from .models import ExtraField


class ExtraFieldFactory(factory.DjangoModelFactory):
class ExtraFieldFactory(DjangoModelFactory):
label = factory.Faker("company")
name = factory.LazyAttribute(lambda o: slugify(o.label))
widget = "TextInput"
Expand Down