diff --git a/app/classes/controllers/users_controller.py b/app/classes/controllers/users_controller.py index cdebbe68..b9c019e8 100644 --- a/app/classes/controllers/users_controller.py +++ b/app/classes/controllers/users_controller.py @@ -241,6 +241,7 @@ class UsersController: email="default@example.com", enabled: bool = True, superuser: bool = False, + theme="default", ): return self.users_helper.add_user( username, @@ -249,6 +250,7 @@ class UsersController: email=email, enabled=enabled, superuser=superuser, + theme=theme, ) @staticmethod diff --git a/app/classes/models/users.py b/app/classes/models/users.py index a6e87316..9b4805a3 100644 --- a/app/classes/models/users.py +++ b/app/classes/models/users.py @@ -43,6 +43,7 @@ class Users(BaseModel): hints = BooleanField(default=True) manager = IntegerField(default=None, null=True) pfp = CharField(default="/static/assets/images/faces-clipart/pic-3.png") + theme = CharField(default="default") class Meta: table_name = "users" @@ -210,6 +211,7 @@ class HelperUsers: email: t.Optional[str] = None, enabled: bool = True, superuser: bool = False, + theme: str = "default", ) -> str: if password is not None: pw_enc = self.helper.encode_pass(password) @@ -225,6 +227,7 @@ class HelperUsers: Users.superuser: superuser, Users.created: Helpers.get_time_as_string(), Users.manager: manager, + Users.theme: theme, } ).execute() return user_id diff --git a/app/migrations/20220926_user_theme.py b/app/migrations/20220926_user_theme.py new file mode 100644 index 00000000..32d1b66d --- /dev/null +++ b/app/migrations/20220926_user_theme.py @@ -0,0 +1,16 @@ +# Generated by database migrator +import peewee + + +def migrate(migrator, database, **kwargs): + migrator.add_columns("users", theme=peewee.CharField(default="default")) + """ + Write your migrations here. + """ + + +def rollback(migrator, database, **kwargs): + migrator.drop_columns("users", ["theme"]) + """ + Write your rollback migrations here. + """