From: Yoan Le Clanche Date: Wed, 2 Dec 2020 12:46:49 +0000 (+0100) Subject: Fix merge issues X-Git-Tag: 2.8.1-ae~87^2~6 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=5c4dee47ac71f2d6f3764b70d35af7296428759f;p=teleforma.git Fix merge issues --- diff --git a/teleforma/admin.py b/teleforma/admin.py index 6b278b4e..19dc0a74 100644 --- a/teleforma/admin.py +++ b/teleforma/admin.py @@ -106,6 +106,11 @@ class BalanceFilter(admin.SimpleListFilter): return queryset +class AEStudentProfileInline(admin.StackedInline): + model = AEStudent + filter_horizontal = ['courses'] + extra = 1 + class StudentAdmin(admin.ModelAdmin): model = Student exclude = ['options', 'training'] @@ -258,6 +263,13 @@ class ConferenceAdmin(admin.ModelAdmin): search_fields = ['public_id', 'id', 'course__code', 'course__title', 'session'] +# class SeminarQuestionInline(admin.StackedInline): +# model = Question + +# class SeminarAdmin(admin.ModelAdmin): +# inlines = [SeminarQuestionInline,] +# exclude = ['suscribers'] + class HomeAdmin(admin.ModelAdmin): list_filter = ('enabled',) search_fields = [ 'periods__name', 'title', 'text' ] @@ -364,10 +376,6 @@ admin.site.register(Training, TrainingAdmin) admin.site.register(CourseType) admin.site.register(StreamingServer) admin.site.register(LiveStream) -admin.site.register(Seminar, SeminarAdmin) -admin.site.register(Question) -admin.site.register(Testimonial) -admin.site.register(TestimonialTemplate) admin.site.register(Student, StudentAdmin) admin.site.register(Corrector, CorrectorAdmin) admin.site.register(Professor, ProfessorAdmin) diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index afe1338c..ac9c31ce 100755 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -59,10 +59,6 @@ class MetaCore: app_label = 'exam' -import crocodoc -crocodoc.api_token = settings.BOX_API_TOKEN - - # import boxsdk # from boxsdk import OAuth2, Client # import StringIO @@ -291,22 +287,6 @@ class Script(BaseResource): verbose_name_plural = _('Scripts') ordering = ['date_added'] - @property - def box_admin_url(self): - user = {'id': self.corrector.id, 'name': unicode(self.corrector)} - session_key = crocodoc.session.create(self.box_uuid, editable=True, user=user, - filter='all', admin=True, downloadable=True, - copyprotected=False, demo=False, sidebar='invisible') - return 'https://crocodoc.com/view/' + session_key - - @property - def box_user_url(self): - user = {'id': 3, 'name': 'TeleForma'} - session_key = crocodoc.session.create(self.box_uuid, editable=False, user=user, - filter='all', admin=False, downloadable=True, - copyprotected=False, demo=False, sidebar='invisible') - return 'https://crocodoc.com/view/' + session_key - def auto_set_corrector(self): self.date_submitted = datetime.datetime.now() @@ -410,45 +390,6 @@ class Script(BaseResource): url = url.replace('http://e-learning.crfpa.pre-barreau.com', '//' + domain) return url - def has_annotations_file(self): - """ - check if an annotations file exists. Then use this file, otherwise use the new db implementation - """ - return os.path.exists(os.path.join(settings.WEBVIEWER_ANNOTATIONS_PATH, self.uuid+'.xfdf')) - - def box_upload(self): - sleep = 10 - max_loop = 12 - loop = 0 - - self.box_uuid = crocodoc.document.upload(url=self.url) - - while True: - statuses = crocodoc.document.status([self.box_uuid,]) - if (len(statuses) != 0): - if (statuses[0].get('error') == None): - if statuses[0]['status'] == 'DONE': - self.box_upload_done = 1 - self.save() - break - else: - loop += 1 - time.sleep(sleep) - if loop > max_loop: - break - else: - print 'File upload failed :(' - print ' Error Message: ' + statuses[0]['error'] - if 'too large' in statuses[0]['error']: - self.auto_reject('file too large') - elif 'retrieving file' in statuses[0]['error']: - self.auto_reject('error retrieving file') - break - else: - print 'failed :(' - print ' Statuses were not returned.' - break - def auto_reject(self, mess): self.reject_reason = mess self.status = 0 diff --git a/teleforma/exam/templates/exam/script_detail.html b/teleforma/exam/templates/exam/script_detail.html index 6a094104..79fd94a5 100644 --- a/teleforma/exam/templates/exam/script_detail.html +++ b/teleforma/exam/templates/exam/script_detail.html @@ -145,12 +145,7 @@

-{# {% if script.has_annotations_file %}#} -{# #} -{# {% else %}#} {% pdfannotator url=script.unquoted_url uuid=script.uuid %} -{# {% endif %}#}
diff --git a/teleforma/migrations/0099_auto__add_appointmentjury__add_appointmentperiod__add_appointmentday__.py b/teleforma/migrations/0099_auto__add_appointmentjury__add_appointmentperiod__add_appointmentday__.py index 22dabdac..fad5781a 100644 --- a/teleforma/migrations/0099_auto__add_appointmentjury__add_appointmentperiod__add_appointmentday__.py +++ b/teleforma/migrations/0099_auto__add_appointmentjury__add_appointmentperiod__add_appointmentday__.py @@ -55,7 +55,7 @@ class Migration(SchemaMigration): # Adding field 'Period.appointment_slot_size' db.add_column('teleforma_period', 'appointment_slot_size', - self.gf('django.db.models.fields.TextField')(default=40), + self.gf('django.db.models.fields.IntegerField')(default=40), keep_default=False) diff --git a/teleforma/migrations/0100_auto__chg_field_period_appointment_slot_size.py b/teleforma/migrations/0100_auto__chg_field_period_appointment_slot_size.py index 7e062cd8..a27d4ec8 100644 --- a/teleforma/migrations/0100_auto__chg_field_period_appointment_slot_size.py +++ b/teleforma/migrations/0100_auto__chg_field_period_appointment_slot_size.py @@ -10,12 +10,12 @@ class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Period.appointment_slot_size' - db.alter_column('teleforma_period', 'appointment_slot_size', self.gf('django.db.models.fields.IntegerField')()) + db.alter_column('teleforma_period', 'appointment_slot_size', self.gf('django.db.models.fields.IntegerField')(default=40)) def backwards(self, orm): # Changing field 'Period.appointment_slot_size' - db.alter_column('teleforma_period', 'appointment_slot_size', self.gf('django.db.models.fields.TextField')()) + db.alter_column('teleforma_period', 'appointment_slot_size', self.gf('django.db.models.fields.IntegerField')()) models = { 'auth.group': { diff --git a/teleforma/migrations/0104_auto__del_appointmentday__del_field_appointmentperiod_book_delay__del_.py b/teleforma/migrations/0104_auto__del_appointmentday__del_field_appointmentperiod_book_delay__del_.py index 5fbc84e9..bf283719 100644 --- a/teleforma/migrations/0104_auto__del_appointmentday__del_field_appointmentperiod_book_delay__del_.py +++ b/teleforma/migrations/0104_auto__del_appointmentday__del_field_appointmentperiod_book_delay__del_.py @@ -105,25 +105,28 @@ class Migration(SchemaMigration): db.alter_column('teleforma_appointment', 'jury_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, on_delete=models.SET_NULL, to=orm['teleforma.AppointmentJury'])) if not db.dry_run: - from teleforma.models import Appointment, AppointmentSlot, AppointmentJury - AppointmentJury.objects.all().delete() - - for date in dates: - - # recreate juries and update slot date - for slotD in date['slots']: - # import pdb;pdb.set_trace() - slot = AppointmentSlot.objects.get(id=slotD['id']) - slot.date = date['date'] - slot.appointment_period_id = date['period'] - slot.save() - for jury in slotD['jurys']: - juryObj = AppointmentJury(slot=slot, name=jury['name'], address=jury['address']) - juryObj.save() - for app in jury['appointments']: - appointment = Appointment.objects.get(id=app) - appointment.jury = juryObj - appointment.save() + pass + # no need on AE (no previous records) + + # from teleforma.models import Appointment, AppointmentSlot, AppointmentJury + # AppointmentJury.objects.all().delete() + + # for date in dates: + + # # recreate juries and update slot date + # for slotD in date['slots']: + # # import pdb;pdb.set_trace() + # slot = AppointmentSlot.objects.get(id=slotD['id']) + # slot.date = date['date'] + # slot.appointment_period_id = date['period'] + # slot.save() + # for jury in slotD['jurys']: + # juryObj = AppointmentJury(slot=slot, name=jury['name'], address=jury['address']) + # juryObj.save() + # for app in jury['appointments']: + # appointment = Appointment.objects.get(id=app) + # appointment.jury = juryObj + # appointment.save() diff --git a/teleforma/models/__init__.py b/teleforma/models/__init__.py index cc80ad53..346d326b 100644 --- a/teleforma/models/__init__.py +++ b/teleforma/models/__init__.py @@ -1,6 +1,6 @@ from core import * from crfpa import * -#from pro import * +# from pro import * from ae import * from messages import * from appointment import * diff --git a/teleforma/models/pro.py b/teleforma/models/pro.py index 9873bfd3..37cd5ef0 100644 --- a/teleforma/models/pro.py +++ b/teleforma/models/pro.py @@ -98,8 +98,8 @@ class Question(Model): class Answer(Model): - user = models.ForeignKey(User, related_name=_("answer"), verbose_name=_('user')) - question = models.ForeignKey(Question, related_name=_("answer"), verbose_name=_('question')) + user = models.ForeignKey(User, related_name="answer", verbose_name=_('user')) + question = models.ForeignKey(Question, related_name="answer", verbose_name=_('question')) answer = models.TextField(_('answer')) status = models.IntegerField(_('status'), choices=STATUS_CHOICES, default=2) validated = models.BooleanField(_('validated')) @@ -114,7 +114,7 @@ class Answer(Model): class Meta(MetaCore): db_table = app_label + '_' + 'answer' - verbose_name = _('Answer') + verbose_name = 'Reponse' class TestimonialTemplate(Model):