diff --git a/src/picture_display/settings.py b/src/picture_display/settings.py index a583286..a925651 100644 --- a/src/picture_display/settings.py +++ b/src/picture_display/settings.py @@ -30,6 +30,8 @@ ALLOWED_HOSTS = [] # Application definition +CUSTOM_APPS = ["pictures"] + INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", @@ -37,7 +39,7 @@ INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", -] +] + CUSTOM_APPS MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", @@ -119,3 +121,5 @@ USE_TZ = False # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = "/static/" + +AUTH_USER_MODEL = "pictures.User" diff --git a/src/picture_display/urls.py b/src/picture_display/urls.py index c7fb36b..0e150f3 100644 --- a/src/picture_display/urls.py +++ b/src/picture_display/urls.py @@ -14,8 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import include, path urlpatterns = [ path("admin/", admin.site.urls), + path("", include("pictures.urls")), ] diff --git a/src/pictures/__init__.py b/src/pictures/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/pictures/admin.py b/src/pictures/admin.py new file mode 100644 index 0000000..6bacd7b --- /dev/null +++ b/src/pictures/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin + +from pictures.models import User + +admin.site.register(User, UserAdmin) diff --git a/src/pictures/apps.py b/src/pictures/apps.py new file mode 100644 index 0000000..4bd420d --- /dev/null +++ b/src/pictures/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PicturesConfig(AppConfig): + name = "pictures" diff --git a/src/pictures/migrations/0001_initial.py b/src/pictures/migrations/0001_initial.py new file mode 100644 index 0000000..51282f0 --- /dev/null +++ b/src/pictures/migrations/0001_initial.py @@ -0,0 +1,132 @@ +# Generated by Django 3.1.5 on 2021-01-24 12:40 + +import django.contrib.auth.models +import django.contrib.auth.validators +import django.utils.timezone +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ("auth", "0012_alter_user_first_name_max_length"), + ] + + operations = [ + migrations.CreateModel( + name="User", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("password", models.CharField(max_length=128, verbose_name="password")), + ( + "last_login", + models.DateTimeField( + blank=True, null=True, verbose_name="last login" + ), + ), + ( + "is_superuser", + models.BooleanField( + default=False, + help_text="Designates that this user has all permissions without explicitly assigning them.", + verbose_name="superuser status", + ), + ), + ( + "username", + models.CharField( + error_messages={ + "unique": "A user with that username already exists." + }, + help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", + max_length=150, + unique=True, + validators=[ + django.contrib.auth.validators.UnicodeUsernameValidator() + ], + verbose_name="username", + ), + ), + ( + "first_name", + models.CharField( + blank=True, max_length=150, verbose_name="first name" + ), + ), + ( + "last_name", + models.CharField( + blank=True, max_length=150, verbose_name="last name" + ), + ), + ( + "email", + models.EmailField( + blank=True, max_length=254, verbose_name="email address" + ), + ), + ( + "is_staff", + models.BooleanField( + default=False, + help_text="Designates whether the user can log into this admin site.", + verbose_name="staff status", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", + verbose_name="active", + ), + ), + ( + "date_joined", + models.DateTimeField( + default=django.utils.timezone.now, verbose_name="date joined" + ), + ), + ( + "groups", + models.ManyToManyField( + blank=True, + help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + related_name="user_set", + related_query_name="user", + to="auth.Group", + verbose_name="groups", + ), + ), + ( + "user_permissions", + models.ManyToManyField( + blank=True, + help_text="Specific permissions for this user.", + related_name="user_set", + related_query_name="user", + to="auth.Permission", + verbose_name="user permissions", + ), + ), + ], + options={ + "verbose_name": "user", + "verbose_name_plural": "users", + "abstract": False, + }, + managers=[ + ("objects", django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/src/pictures/migrations/__init__.py b/src/pictures/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/pictures/models.py b/src/pictures/models.py new file mode 100644 index 0000000..7e21811 --- /dev/null +++ b/src/pictures/models.py @@ -0,0 +1,6 @@ +from django.contrib.auth.models import AbstractUser +from django.db import models + + +class User(AbstractUser): + pass diff --git a/src/pictures/tests.py b/src/pictures/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/src/pictures/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/pictures/urls.py b/src/pictures/urls.py new file mode 100644 index 0000000..b9cad47 --- /dev/null +++ b/src/pictures/urls.py @@ -0,0 +1,5 @@ +from django.urls import path + +urlpatterns = [ + # path("", PicturesView.as_view(), name="pictures-list"), +] diff --git a/src/pictures/views.py b/src/pictures/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/src/pictures/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.