Add type hint for UserFactory

Since factory-boy 3.3.1, we can type annotate factories:

https://github.com/FactoryBoy/factory_boy/pull/1059

Setting that up for the only factory of the project
This commit is contained in:
Bruno Alla 2024-08-21 10:29:45 +02:00
parent f28b74f2df
commit a808e62810
No known key found for this signature in database

View File

@ -8,7 +8,7 @@ from factory.django import DjangoModelFactory
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
class UserFactory(DjangoModelFactory): class UserFactory(DjangoModelFactory[User]):
{%- if cookiecutter.username_type == "username" %} {%- if cookiecutter.username_type == "username" %}
username = Faker("user_name") username = Faker("user_name")
{%- endif %} {%- endif %}