1
0

Initial Commit

This commit is contained in:
2017-12-31 03:40:56 +03:00
commit 4dbb509588
18 changed files with 343 additions and 0 deletions

0
app/__init__.py Normal file
View File

3
app/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
app/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class AppConfig(AppConfig):
name = 'app'

View File

9
app/models.py Normal file
View File

@@ -0,0 +1,9 @@
from django.db import models
# Create your models here.
class Setting(models.Model):
name = models.CharField(max_length=100)
language = models.CharField(max_length=5)
string = models.TextField()

11
app/settings_db.py Normal file
View File

@@ -0,0 +1,11 @@
from django.core.exceptions import ObjectDoesNotExist
from app.models import Setting
from django.conf import settings
def get_setting(name, language=settings.LANGUAGE_CODE):
# TODO: This function
try:
return Setting.objects.filter(name=name)[0].get().string
except ObjectDoesNotExist:
return 'Oops, setting {0} not found!'.format(name)

3
app/tests.py Normal file
View File

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

14
app/views.py Normal file
View File

@@ -0,0 +1,14 @@
from django.shortcuts import render
from django.utils.translation import gettext as _
from django.conf import settings
# Create your views here.
def home(request):
return render(request, 'home.html', {
'title': _('Home'),
'app_name': settings.APP_NAME,
'app_description_text': get_setting('app_description_text'),
})