mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 09:24:52 +03:00
Fix more empty lines issues
This commit is contained in:
parent
933d228607
commit
f6372c3ec2
|
@ -1,14 +1,16 @@
|
||||||
{%- if cookiecutter.username_type == "email" %}
|
{%- if cookiecutter.username_type == "email" %}
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.contrib.auth.models import AbstractUser, UserManager as DjangoUserManager
|
{%- endif -%}
|
||||||
{%- else %}
|
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser
|
||||||
|
{%- if cookiecutter.username_type == "email" %}
|
||||||
|
from django.contrib.auth.models import UserManager as DjangoUserManager
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
from django.db.models import CharField{% if cookiecutter.username_type == "email" %}, EmailField{% endif %}
|
from django.db.models import CharField{% if cookiecutter.username_type == "email" %}, EmailField{% endif %}
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
{%- if cookiecutter.username_type == "email" %}
|
{%- if cookiecutter.username_type == "email" %}
|
||||||
|
|
||||||
|
|
||||||
class UserManager(DjangoUserManager):
|
class UserManager(DjangoUserManager):
|
||||||
def _create_user(self, email, password, **extra_fields):
|
def _create_user(self, email, password, **extra_fields):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,10 +5,7 @@ from {{ cookiecutter.project_slug }}.users.models import User
|
||||||
|
|
||||||
def test_detail(user: User):
|
def test_detail(user: User):
|
||||||
{%- if cookiecutter.username_type == "email" %}
|
{%- if cookiecutter.username_type == "email" %}
|
||||||
assert (
|
assert reverse("users:detail", kwargs={"pk": user.pk}) == f"/users/{user.pk}/"
|
||||||
reverse("users:detail", kwargs={"pk": user.pk})
|
|
||||||
== f"/users/{user.pk}/"
|
|
||||||
)
|
|
||||||
assert resolve(f"/users/{user.pk}/").view_name == "users:detail"
|
assert resolve(f"/users/{user.pk}/").view_name == "users:detail"
|
||||||
{%- else %}
|
{%- else %}
|
||||||
assert (
|
assert (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user