Try linting again

This commit is contained in:
Andrew-Chen-Wang 2022-11-22 14:58:55 -05:00
parent e7ed1434c9
commit eaf073d232
2 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ class UserAdmin(auth_admin.UserAdmin):
) )
list_display = ["{{cookiecutter.username_type}}", "name", "is_superuser"] list_display = ["{{cookiecutter.username_type}}", "name", "is_superuser"]
search_fields = ["name"] search_fields = ["name"]
{% if cookiecutter.username_type == "email" -%} {%- if cookiecutter.username_type == "email" -%}
ordering = ["id"] ordering = ["id"]
add_fieldsets = ( add_fieldsets = (
( (

View File

@ -4,11 +4,11 @@ from django.contrib.auth.models import AbstractUser, UserManager as DjangoUserMa
{%- else %} {%- else %}
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
{%- endif %} {%- endif %}
from django.db.models import CharField, EmailField 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):
""" """
@ -49,7 +49,7 @@ class User(AbstractUser):
#: First and last name do not cover name patterns around the globe #: First and last name do not cover name patterns around the globe
name = CharField(_("Name of User"), blank=True, max_length=255) name = CharField(_("Name of User"), blank=True, max_length=255)
{% if cookiecutter.username_type == "email" -%} {%- if cookiecutter.username_type == "email" -%}
username = None # type: ignore username = None # type: ignore
email = EmailField(_("email address"), unique=True) email = EmailField(_("email address"), unique=True)
{%- endif %} {%- endif %}