Remove bundled dbsettings, add to requirements

This commit is contained in:
Kumi 2021-02-06 11:41:57 +00:00
parent 169199e765
commit c4154e6a02
9 changed files with 3 additions and 62 deletions

View file

@ -1 +0,0 @@
default_app_config = 'dbsettings.apps.SettingsConfig'

View file

@ -1,6 +0,0 @@
from django.contrib import admin
from dbsettings.models import Setting
# Register your models here.
admin.site.register(Setting)

View file

@ -1,6 +0,0 @@
from django.apps import AppConfig
class SettingsConfig(AppConfig):
name = 'dbsettings'
verbose_name = "Application Settings"

View file

@ -1,21 +0,0 @@
# Generated by Django 2.2.6 on 2019-10-26 15:21
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Setting',
fields=[
('key', models.CharField(max_length=512, primary_key=True, serialize=False)),
('value', models.CharField(max_length=512)),
],
),
]

View file

@ -1,10 +0,0 @@
from django.db import models
# Create your models here.
class Setting(models.Model):
key = models.CharField(primary_key=True, max_length=512)
value = models.CharField(max_length=512)
def __str__(self):
return self.key

View file

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View file

@ -1,14 +0,0 @@
from django.shortcuts import render
from dbsettings.models import Setting
def getValue(key):
try:
return Setting.objects.get(key=key).value
except:
raise KeyError("No such setting: %s" % key)
def setValue(key, value):
obj = Setting.objects.get_or_create(key=key)[0] # pylint: disable=E1101
obj.value = value
obj.save()
return True

View file

@ -5,3 +5,5 @@ django
django-storages
boto3
kumisms
python-telegram-bot
git+https://kumig.it/kumisystems/django-dbsettings.git