mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 01:26:57 +03:00
Add type hint for UserFactory (#5312)
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:
parent
f28b74f2df
commit
69927387f8
|
@ -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 %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user