Commit 1e2b62f038fbfc064545af0dce903408554555ea
1 parent
48ad66ea
Exists in
master
and in
3 other branches
Adding system settings apps
Showing
25 changed files
with
188 additions
and
1 deletions
Show diff stats
amadeus/settings.py
@@ -56,7 +56,10 @@ INSTALLED_APPS = [ | @@ -56,7 +56,10 @@ INSTALLED_APPS = [ | ||
56 | 'notifications', | 56 | 'notifications', |
57 | 'log', | 57 | 'log', |
58 | 'categories', | 58 | 'categories', |
59 | - 'subjects' | 59 | + 'subjects', |
60 | + 'mailsender', | ||
61 | + 'security', | ||
62 | + 'themes' | ||
60 | ] | 63 | ] |
61 | 64 | ||
62 | MIDDLEWARE_CLASSES = [ | 65 | MIDDLEWARE_CLASSES = [ |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2017-01-06 19:14 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + initial = True | ||
11 | + | ||
12 | + dependencies = [ | ||
13 | + ] | ||
14 | + | ||
15 | + operations = [ | ||
16 | + migrations.CreateModel( | ||
17 | + name='MailSender', | ||
18 | + fields=[ | ||
19 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
20 | + ('description', models.CharField(max_length=200, verbose_name='Description')), | ||
21 | + ('hostname', models.CharField(max_length=200, verbose_name='Host name')), | ||
22 | + ('port', models.IntegerField(verbose_name='Port Number')), | ||
23 | + ('username', models.CharField(max_length=200, verbose_name='Username')), | ||
24 | + ('password', models.CharField(max_length=256, verbose_name='Password')), | ||
25 | + ('crypto', models.IntegerField(choices=[(1, 'No'), (2, 'SSL'), (3, 'TLS'), (4, 'TLS, if possible')], verbose_name='Criptografy')), | ||
26 | + ], | ||
27 | + options={ | ||
28 | + 'verbose_name': 'Mail sender configuration', | ||
29 | + 'verbose_name_plural': 'Mail sender configurations', | ||
30 | + }, | ||
31 | + ), | ||
32 | + ] |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +from django.db import models | ||
2 | +from django.utils.translation import ugettext_lazy as _ | ||
3 | + | ||
4 | +class MailSender(models.Model): | ||
5 | + description = models.CharField(_('Description'), max_length = 200) | ||
6 | + hostname = models.CharField(_('Host name'), max_length = 200) | ||
7 | + port = models.IntegerField(_('Port Number')) | ||
8 | + username = models.CharField(_('Username'), max_length = 200) | ||
9 | + password = models.CharField(_('Password'), max_length = 256) | ||
10 | + crypto = models.IntegerField(_('Criptografy'), choices = ((1, _('No')), (2, _('SSL')), (3, _('TLS')), (4, _('TLS, if possible')))) | ||
11 | + | ||
12 | + class Meta: | ||
13 | + verbose_name = _('Mail sender configuration') | ||
14 | + verbose_name_plural = _('Mail sender configurations') | ||
15 | + | ||
16 | + def __str__(self): | ||
17 | + return self.description |
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2017-01-06 19:14 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + initial = True | ||
11 | + | ||
12 | + dependencies = [ | ||
13 | + ] | ||
14 | + | ||
15 | + operations = [ | ||
16 | + migrations.CreateModel( | ||
17 | + name='Security', | ||
18 | + fields=[ | ||
19 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
20 | + ('allow_register', models.BooleanField(default=False, verbose_name="Don't allow users to self-register")), | ||
21 | + ('maintence', models.BooleanField(default=False, verbose_name='Put system in maintence mode')), | ||
22 | + ], | ||
23 | + options={ | ||
24 | + 'verbose_name': 'Security configuration', | ||
25 | + 'verbose_name_plural': 'Security configurations', | ||
26 | + }, | ||
27 | + ), | ||
28 | + ] |
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +from django.db import models | ||
2 | +from django.utils.translation import ugettext_lazy as _ | ||
3 | + | ||
4 | +class Security(models.Model): | ||
5 | + allow_register = models.BooleanField(_("Don't allow users to self-register"), default = False) | ||
6 | + maintence = models.BooleanField(_("Put system in maintence mode"), default = False) | ||
7 | + | ||
8 | + class Meta: | ||
9 | + verbose_name = _('Security configuration') | ||
10 | + verbose_name_plural = _('Security configurations') |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2017-01-06 19:14 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | +import themes.models | ||
7 | + | ||
8 | + | ||
9 | +class Migration(migrations.Migration): | ||
10 | + | ||
11 | + initial = True | ||
12 | + | ||
13 | + dependencies = [ | ||
14 | + ] | ||
15 | + | ||
16 | + operations = [ | ||
17 | + migrations.CreateModel( | ||
18 | + name='Themes', | ||
19 | + fields=[ | ||
20 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
21 | + ('title', models.CharField(default='Projeto Amadeus', max_length=200, verbose_name='Title')), | ||
22 | + ('small_logo', models.ImageField(blank=True, default='logo_pequena_amadeus.png', upload_to='themes/', validators=[themes.models.validate_img_extension], verbose_name='Small Logo')), | ||
23 | + ('large_logo', models.ImageField(blank=True, default='logo_grande_amadeus.png', upload_to='themes/', validators=[themes.models.validate_img_extension], verbose_name='Large Logo')), | ||
24 | + ('footer_note', models.TextField(blank=True, verbose_name='Footer Note')), | ||
25 | + ('css_style', models.CharField(default='green', max_length=50, verbose_name='Css Style')), | ||
26 | + ], | ||
27 | + options={ | ||
28 | + 'verbose_name': 'Theme', | ||
29 | + 'verbose_name_plural': 'Themes', | ||
30 | + }, | ||
31 | + ), | ||
32 | + ] |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +from django.db import models | ||
2 | +from django.utils.translation import ugettext_lazy as _ | ||
3 | + | ||
4 | +def validate_img_extension(value): | ||
5 | + valid_formats = ['image/jpeg','image/x-citrix-jpeg','image/png','image/x-citrix-png','image/x-png'] | ||
6 | + | ||
7 | + if hasattr(value.file, 'content_type'): | ||
8 | + if not value.file.content_type in valid_formats: | ||
9 | + raise ValidationError(_('File not supported.')) | ||
10 | + | ||
11 | +class Themes(models.Model): | ||
12 | + title = models.CharField(_("Title"), max_length = 200, default = "Projeto Amadeus") | ||
13 | + small_logo = models.ImageField(verbose_name = _("Small Logo"), blank = True, upload_to = 'themes/', default = 'logo_pequena_amadeus.png', validators = [validate_img_extension]) | ||
14 | + large_logo = models.ImageField(verbose_name = _("Large Logo"), blank = True, upload_to = 'themes/', default = 'logo_grande_amadeus.png', validators = [validate_img_extension]) | ||
15 | + footer_note = models.TextField(_("Footer Note"), blank = True) | ||
16 | + css_style = models.CharField(_("Css Style"), max_length = 50, default = "green") | ||
17 | + | ||
18 | + class Meta: | ||
19 | + verbose_name = _("Theme") | ||
20 | + verbose_name_plural = _("Themes") | ||
21 | + | ||
22 | + def __str__(self): | ||
23 | + return self.title |