Commit 27c82d68ae671ef73bd8b630858af9b9dbecc355
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
5 changed files
with
63 additions
and
4 deletions
Show diff stats
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-12 17:29 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('core', '0001_initial'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.CreateModel( | ||
16 | + name='MymeType', | ||
17 | + fields=[ | ||
18 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
19 | + ('typ', models.CharField(max_length=100, unique=True, verbose_name='Type')), | ||
20 | + ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), | ||
21 | + ], | ||
22 | + options={ | ||
23 | + 'verbose_name_plural': 'Amadeus Myme Types', | ||
24 | + 'verbose_name': 'Amadeus Myme Type', | ||
25 | + }, | ||
26 | + ), | ||
27 | + ] |
core/models.py
@@ -4,6 +4,20 @@ from users.models import User | @@ -4,6 +4,20 @@ from users.models import User | ||
4 | from autoslug.fields import AutoSlugField | 4 | from autoslug.fields import AutoSlugField |
5 | # Create your models here. | 5 | # Create your models here. |
6 | 6 | ||
7 | +class MymeType(models.Model): | ||
8 | + typ = models.CharField(_('Type'), max_length=100, unique=True) | ||
9 | + icon = models.CharField(_('Icon'), max_length=50, unique=True) | ||
10 | + | ||
11 | + class Meta: | ||
12 | + verbose_name= _('Amadeus Myme Type') | ||
13 | + verbose_name_plural = _('Amadeus Myme Types') | ||
14 | + | ||
15 | + def get_icon(self, type): | ||
16 | + pass | ||
17 | + | ||
18 | + def __str__(self): | ||
19 | + return self.typ | ||
20 | + | ||
7 | class Action(models.Model): | 21 | class Action(models.Model): |
8 | """ | 22 | """ |
9 | It represents an Action on the program by a User such as "create post", | 23 | It represents an Action on the program by a User such as "create post", |
core/static/js/base/amadeus.js
@@ -61,16 +61,21 @@ function formatarTelefone(campo, evento){ | @@ -61,16 +61,21 @@ function formatarTelefone(campo, evento){ | ||
61 | } | 61 | } |
62 | tamanho = campo.value.length; | 62 | tamanho = campo.value.length; |
63 | 63 | ||
64 | - if((codTecla > 47 && codTecla < 58) && tamanho < 14){ | 64 | + if(((codTecla > 47 && codTecla < 58) || (codTecla == 8)) && tamanho < 15){ |
65 | 65 | ||
66 | if(tamanho == 0){ | 66 | if(tamanho == 0){ |
67 | campo.value = "(" + campo.value; | 67 | campo.value = "(" + campo.value; |
68 | }else if( tamanho == 3 ){ | 68 | }else if( tamanho == 3 ){ |
69 | - campo.value = campo.value + ")"; | 69 | + campo.value = campo.value + ") "; |
70 | }else if(tamanho == 9){ | 70 | }else if(tamanho == 9){ |
71 | campo.value = campo.value + "-"; | 71 | campo.value = campo.value + "-"; |
72 | + }else if(tamanho == 14){ | ||
73 | + // alert('oi'); | ||
74 | + campo.value = campo.value.slice(0, 4) + campo.value.slice(5, 14); | ||
75 | + campo.value = campo.value.slice(0, 8) + campo.value.slice(9, 10) + campo.value.slice(8, 9) + campo.value.slice(10, 14) | ||
72 | } | 76 | } |
73 | return true; | 77 | return true; |
78 | + | ||
74 | } else if(codTecla == 0 || codTecla == 8){ | 79 | } else if(codTecla == 0 || codTecla == 8){ |
75 | return true; | 80 | return true; |
76 | } else { | 81 | } else { |
courses/models.py
@@ -2,7 +2,7 @@ from django.utils.translation import ugettext_lazy as _ | @@ -2,7 +2,7 @@ from django.utils.translation import ugettext_lazy as _ | ||
2 | from django.db import models | 2 | from django.db import models |
3 | from autoslug.fields import AutoSlugField | 3 | from autoslug.fields import AutoSlugField |
4 | from users.models import User | 4 | from users.models import User |
5 | -from core.models import Resource | 5 | +from core.models import Resource, MymeType |
6 | from s3direct.fields import S3DirectField | 6 | from s3direct.fields import S3DirectField |
7 | 7 | ||
8 | class CourseCategory(models.Model): | 8 | class CourseCategory(models.Model): |
@@ -116,6 +116,19 @@ class Material(Resource): | @@ -116,6 +116,19 @@ class Material(Resource): | ||
116 | all_students = models.BooleanField(_('All Students'), default=False) | 116 | all_students = models.BooleanField(_('All Students'), default=False) |
117 | 117 | ||
118 | """ | 118 | """ |
119 | +Topic File | ||
120 | +""" | ||
121 | +class File(Material): | ||
122 | + description = models.TextField(_('Description'), blank=True) | ||
123 | + content = models.FileField(upload_to='uploads/courses/subject/topic/%Y/%m/%d/') | ||
124 | + typ = models.ForeignKey(MymeType, verbose_name= _('Type'), related_name='file') | ||
125 | + | ||
126 | + class Meta: | ||
127 | + verbose_name = _('Topic file') | ||
128 | + verbose_name_plural = _('Topic files') | ||
129 | + | ||
130 | + | ||
131 | +""" | ||
119 | It is a category for each subject. | 132 | It is a category for each subject. |
120 | """ | 133 | """ |
121 | class SubjectCategory(models.Model): | 134 | class SubjectCategory(models.Model): |
users/admin.py
@@ -5,6 +5,6 @@ from .forms import AdminUserForm | @@ -5,6 +5,6 @@ from .forms import AdminUserForm | ||
5 | class UserAdmin(admin.ModelAdmin): | 5 | class UserAdmin(admin.ModelAdmin): |
6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] | 6 | list_display = ['username', 'name', 'email', 'is_staff', 'is_active'] |
7 | search_fields = ['username', 'name', 'email'] | 7 | search_fields = ['username', 'name', 'email'] |
8 | - form = AdminUserForm | 8 | + # form = AdminUserForm |
9 | 9 | ||
10 | admin.site.register(User, UserAdmin) | 10 | admin.site.register(User, UserAdmin) |
11 | \ No newline at end of file | 11 | \ No newline at end of file |