Added more docstrings.
This commit is contained in:
parent
29f7834921
commit
d985efada9
3 changed files with 13 additions and 9 deletions
|
@ -4,6 +4,9 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class Timestampable(models.Model):
|
class Timestampable(models.Model):
|
||||||
|
"""
|
||||||
|
Mixin for keeping track of when an object was created and last modified.
|
||||||
|
"""
|
||||||
created_date = models.DateTimeField(_('added on'), auto_now_add=True)
|
created_date = models.DateTimeField(_('added on'), auto_now_add=True)
|
||||||
modified_date = models.DateTimeField(_('last modified'), auto_now=True)
|
modified_date = models.DateTimeField(_('last modified'), auto_now=True)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.0 on 2017-12-27 21:02
|
# Generated by Django 2.0 on 2017-12-29 13:36
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
|
@ -38,10 +38,10 @@ class Migration(migrations.Migration):
|
||||||
name='Setting',
|
name='Setting',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('name', models.CharField(max_length=64, unique=True)),
|
('name', models.CharField(max_length=64, unique=True, verbose_name='name')),
|
||||||
('description', models.TextField(blank=True)),
|
('description', models.TextField(blank=True, verbose_name='description')),
|
||||||
('setting_type', models.PositiveIntegerField(choices=[(0, 'Integer'), (1, 'Float'), (2, 'String'), (3, 'Bool')], default=0)),
|
('setting_type', models.PositiveIntegerField(choices=[(0, 'Integer'), (1, 'Float'), (2, 'String'), (3, 'Bool')], default=0, verbose_name='variable type')),
|
||||||
('data', models.TextField()),
|
('data', models.TextField(verbose_name='data')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -31,11 +31,12 @@ class Setting(models.Model):
|
||||||
(STRING, 'String'),
|
(STRING, 'String'),
|
||||||
(BOOL, 'Bool'),
|
(BOOL, 'Bool'),
|
||||||
)
|
)
|
||||||
name = models.CharField(max_length=64, unique=True)
|
name = models.CharField(_('name'), max_length=64, unique=True)
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(_('description'), blank=True)
|
||||||
setting_type = models.PositiveIntegerField(choices=TYPE_CHOICES,
|
setting_type = models.PositiveIntegerField(_('variable type'),
|
||||||
|
choices=TYPE_CHOICES,
|
||||||
default=INTEGER)
|
default=INTEGER)
|
||||||
data = models.TextField()
|
data = models.TextField(_('data'))
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
if self.setting_type == self.INTEGER:
|
if self.setting_type == self.INTEGER:
|
||||||
|
|
Loading…
Reference in a new issue