feat(settings): Provide user with the ability to set browser mode
ref: #554 #481 #507 nofusscomputing/centurion_erp_ui#71
This commit is contained in:
@ -19,6 +19,7 @@ class UserSettingsForm(CommonModelForm):
|
||||
fields = [
|
||||
'default_organization',
|
||||
'timezone',
|
||||
'browser_mode',
|
||||
]
|
||||
|
||||
model = UserSettings
|
||||
|
18
app/settings/migrations/0009_usersettings_browser_mode.py
Normal file
18
app/settings/migrations/0009_usersettings_browser_mode.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.5 on 2025-02-10 07:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('settings', '0008_alter_externallink_organization_externallinknotes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='usersettings',
|
||||
name='browser_mode',
|
||||
field=models.IntegerField(choices=[(1, 'Auto'), (2, 'Dark'), (3, 'Light')], default=1, help_text="Set your web browser's mode", verbose_name='Browser Mode'),
|
||||
),
|
||||
]
|
@ -54,6 +54,13 @@ class UserSettings(UserSettingsCommonFields):
|
||||
verbose_name_plural = 'User Settings'
|
||||
|
||||
|
||||
class BrowserMode(models.IntegerChoices):
|
||||
|
||||
AUTO = 1, 'Auto'
|
||||
DARK = 2, 'Dark'
|
||||
LIGHT = 3, 'Light'
|
||||
|
||||
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
blank= False,
|
||||
@ -63,6 +70,13 @@ class UserSettings(UserSettingsCommonFields):
|
||||
verbose_name = 'User'
|
||||
)
|
||||
|
||||
browser_mode = models.IntegerField(
|
||||
blank = False,
|
||||
choices = BrowserMode,
|
||||
default = BrowserMode.AUTO,
|
||||
help_text = "Set your web browser's mode",
|
||||
verbose_name = 'Browser Mode',
|
||||
)
|
||||
|
||||
default_organization = models.ForeignKey(
|
||||
Organization,
|
||||
|
@ -48,6 +48,11 @@
|
||||
<span>{{ settings.timezone }}</span>
|
||||
</div>
|
||||
|
||||
<div class="detail-view-field">
|
||||
<label>{{ form.browser_mode.label }}</label>
|
||||
<span>{{ settings.get_browser_mode_display }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<input type="button" value="Edit"
|
||||
|
Reference in New Issue
Block a user