diff --git a/requirements.txt b/requirements.txt index e323b83..25a7b2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,14 @@ +-e git://github.com/maxicecilia/django-dropbox.git@0.1.0#egg=django_dropbox -e git://github.com/maxicecilia/django_site_news.git@7d320097cedec159e396ad3d223b3919d6449c3e#egg=django_site_news-0.1.1 -e git://github.com/maxicecilia/django_contact_us.git@2.1#egg=django_contact_us argparse==1.2.1 django-bootstrap3==5.1.1 -django-dropbox==0.0.2 django-registration-redux==1.1 django-sitesutils==0.1.2 django-sitetree==1.2.1 django-tinymce==1.5.3 Django==1.7.3 psycopg2==2.5.4 -dropbox==2.2.0 ipdb==0.8 ipython==2.3.1 Pillow==2.7.0 diff --git a/simple_classroom/apps/bibliography/models.py b/simple_classroom/apps/bibliography/models.py index 54e79dc..276f575 100644 --- a/simple_classroom/apps/bibliography/models.py +++ b/simple_classroom/apps/bibliography/models.py @@ -2,7 +2,6 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from simple_classroom.apps.downloads import STORAGE -from simple_classroom.apps.core.models import DropboxStorageMixin from simple_classroom.apps.classroom.models import Subject @@ -19,12 +18,13 @@ def __unicode__(self): return u'{}'.format(self.name) -class Book(models.Model, DropboxStorageMixin): +class Book(models.Model): author = models.CharField(_(u'Autor'), max_length=255, null=False, blank=False) category = models.ForeignKey(GroupCategory) edition = models.CharField(_(u'Edición'), max_length=255, null=False, blank=False) editorial = models.CharField(_(u'Editorial'), max_length=255, null=False, blank=False) - cover_image = models.ImageField(_(u'Imagen'), upload_to='books', storage=STORAGE, null=True, blank=True) + cover_image = models.ImageField(_(u'Imagen'), upload_to='books', storage=STORAGE, + null=True, blank=True) subject = models.ForeignKey(Subject) title = models.CharField(_(u'Titulo'), max_length=255, null=False, blank=False) diff --git a/simple_classroom/apps/classroom/models.py b/simple_classroom/apps/classroom/models.py index 520292e..bf98b78 100644 --- a/simple_classroom/apps/classroom/models.py +++ b/simple_classroom/apps/classroom/models.py @@ -10,7 +10,6 @@ from django.utils.translation import ugettext as _ from ordered_model.models import OrderedModel from tinymce.models import HTMLField -from simple_classroom.apps.core.models import DropboxStorageMixin from simple_classroom.apps.downloads import STORAGE from .managers import AssignmentManager, DictationManager, EnrolledManager @@ -59,12 +58,17 @@ class Dictation(models.Model): subject = models.ForeignKey(Subject) date_from = models.DateField(_('Desde'), null=True, blank=True) date_to = models.DateField(_('Hasta'), null=True, blank=True) - semester = models.IntegerField(_('Semestre'), choices=SEMESTER_CHOICES, default=1, null=False, blank=False) + semester = models.IntegerField(_('Semestre'), choices=SEMESTER_CHOICES, default=1, + null=False, blank=False) year = models.IntegerField(_(u'Año'), null=False, blank=False) - is_registration_open = models.BooleanField(_(u'Registración abierta'), default=True, null=False, blank=False) - dictated_practice_hours = models.PositiveIntegerField(_(u'Horas dictadas de práctica'), default=0, null=False, blank=False) - dictated_theory_hours = models.PositiveIntegerField(_(u'Horas dictadas de teoría'), default=0, null=False, blank=False) - last_modification_date = models.DateTimeField(_(u'Fecha de última modificación'), null=True, blank=True) + is_registration_open = models.BooleanField(_(u'Registración abierta'), default=True, + null=False, blank=False) + dictated_practice_hours = models.PositiveIntegerField(_(u'Horas dictadas de práctica'), + default=0, null=False, blank=False) + dictated_theory_hours = models.PositiveIntegerField(_(u'Horas dictadas de teoría'), + default=0, null=False, blank=False) + last_modification_date = models.DateTimeField(_(u'Fecha de última modificación'), + null=True, blank=True) objects = DictationManager() @@ -88,9 +92,10 @@ def save(self, *args, **kwargs): super(Dictation, self).save(*args, **kwargs) -class TeacherProfile(OrderedModel, DropboxStorageMixin): +class TeacherProfile(OrderedModel): abstract = HTMLField(null=True, blank=True) - avatar = models.ImageField(_(u'Avatar'), upload_to='avatar', storage=STORAGE, null=True, blank=True) + avatar = models.ImageField(_(u'Avatar'), upload_to='avatar', storage=STORAGE, + null=True, blank=True) dictation = models.ManyToManyField(Dictation, verbose_name=_(u'Dictado')) user = models.OneToOneField(User, verbose_name=_(u'Usuario')) @@ -160,7 +165,8 @@ class Assignment(OrderedModel): _(u'Corregido'), blank=False, null=False, default=False, help_text=_(u'Tildar para indicar que la evaluación ya fue corregida y las notas están disponibles.')) score_date = models.DateTimeField(_(u'Fecha de Notas'), blank=True, null=True) - assignment_type = models.IntegerField(_('Tipo'), choices=ASSIGNMENT_TYPES, default=4, null=False, blank=False) + assignment_type = models.IntegerField(_('Tipo'), choices=ASSIGNMENT_TYPES, default=4, + null=False, blank=False) objects = AssignmentManager() class Meta(OrderedModel.Meta): @@ -229,4 +235,4 @@ def get_average(self): average = self.assignment.score_set.exclude(value=-1).aggregate(Avg('value'))['value__avg'] return '%.2f' % average except: - return '' \ No newline at end of file + return '' diff --git a/simple_classroom/apps/core/models.py b/simple_classroom/apps/core/models.py index 76abdf6..4216fcd 100644 --- a/simple_classroom/apps/core/models.py +++ b/simple_classroom/apps/core/models.py @@ -10,16 +10,3 @@ class ExtendedSite(models.Model): def __unicode__(self): return u'Extended info for {0}'.format(self.site.name) - - -class DropboxStorageMixin(object): - """Simple mixin to add a method to retrieve the public URL for a dropbox stored image.""" - - def get_public_url(self, url): - return url.replace('www.dropbox', 'dl.dropboxusercontent') - - def get_image_url(self): - try: - return self.get_public_url(self.default_image.url) - except Exception: - return '' diff --git a/simple_classroom/apps/downloads/models.py b/simple_classroom/apps/downloads/models.py index 71fb350..ffe4ee7 100644 --- a/simple_classroom/apps/downloads/models.py +++ b/simple_classroom/apps/downloads/models.py @@ -4,7 +4,6 @@ from django.db import models from django.utils.translation import ugettext as _ from simple_classroom.apps.classroom.models import Assignment -from simple_classroom.apps.core.models import DropboxStorageMixin from simple_classroom.apps.downloads import STORAGE @@ -18,7 +17,7 @@ def get_upload_path(instance, filename): instance.data.name) -class Download(models.Model, DropboxStorageMixin): +class Download(models.Model): ''' TODO: Change this name to a more specific one.''' assignment = models.ForeignKey(Assignment) title = models.CharField(_(u'Título'), max_length=255, blank=False, null=False) @@ -34,13 +33,7 @@ def __unicode__(self): return u'{}'.format(self.title) def get_data_url(self): - try: - return self.get_public_url(self.data.url) - except: - try: - return self.data.url - except: - return '' + return self.data.url def get_icon_path(self): if self.title.lower() == 'evaluativo': @@ -68,7 +61,7 @@ def __unicode__(self): return u'{}'.format(self.name) -class SiteDownload(models.Model, DropboxStorageMixin): +class SiteDownload(models.Model): ''' All downloads related to the site/subject''' SLIDE = _(u'Diapositivas') RESOURCE = _(u'Recursos para el alumno') diff --git a/simple_classroom/settings/base.py b/simple_classroom/settings/base.py index 64474a7..c2e969f 100644 --- a/simple_classroom/settings/base.py +++ b/simple_classroom/settings/base.py @@ -129,20 +129,15 @@ os.path.join(BASE_DIR, 'simple_classroom/static'), ) -ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value. +ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window REGISTRATION_AUTO_LOGIN = False # Automatically log the user in. REGISTRATION_OPEN = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -# Dropbox config -DROPBOX_CONSUMER_KEY = '' -DROPBOX_CONSUMER_SECRET = '' - # Token for simple_classroom. DROPBOX_ACCESS_TOKEN = '' -DROPBOX_ACCESS_TOKEN_SECRET = '' # ReCaptcha Site and Secret keys. RECAPTCHA_PRIVATE_KEY = '' diff --git a/simple_classroom/templates/accounts/teacher_profile.html b/simple_classroom/templates/accounts/teacher_profile.html index 4fae1ae..9f7995a 100644 --- a/simple_classroom/templates/accounts/teacher_profile.html +++ b/simple_classroom/templates/accounts/teacher_profile.html @@ -9,13 +9,13 @@
Titulo | @@ -13,8 +13,8 @@||
---|---|---|
{{ object.title|default:"-" }} | -{% if object.get_image_url %}Descarga{% endif %} | +{% if object.default_image.url %}Descarga{% endif %} |