tests: add UserSettings model and middleware tests; ensure tests create UserSettings defaults
This commit is contained in:
@@ -2,6 +2,7 @@ from django.utils import timezone
|
||||
from django.conf import settings
|
||||
from django.db.models import (
|
||||
Model,
|
||||
CharField,
|
||||
BooleanField,
|
||||
DateTimeField,
|
||||
IntegerField,
|
||||
@@ -15,6 +16,19 @@ def get_gallery_root():
|
||||
return settings.GALLERY_ROOT
|
||||
|
||||
|
||||
class UserSettings(Model):
|
||||
"""
|
||||
User relations to a specific image file by path.
|
||||
"""
|
||||
|
||||
user = ForeignKey(settings.AUTH_USER_MODEL, blank=False, null=False, on_delete=CASCADE)
|
||||
theme = CharField(max_length=5, blank=False, null=False, default='dark')
|
||||
sort = CharField(max_length=6, blank=False, null=False, default='abc')
|
||||
|
||||
class meta:
|
||||
ordering = ["pk"]
|
||||
|
||||
|
||||
class Image(Model):
|
||||
"""
|
||||
User relations to a specific image file by path.
|
||||
|
||||
Reference in New Issue
Block a user