class CourseAdmin(admin.ModelAdmin):
model = Course
ordering = ['number']
+ # filter_horizontal = ['types']
+
class DocumentAdmin(admin.ModelAdmin):
exclude = ['readers']
filter_horizontal = ['course_type']
{% with c.course as course %}
{% for type in c.types %}
<div class="course">
- <div class="course_title">{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %}
+ <div class="course_title">{{ course.title }}{% if type.name != "None" %} - {{ type }}{% endif %}{% if course.description %} - {{ course.description }}{% endif %}
</div>
- {% if not user.correctors.all or user.is_staff %}
- {% block conference %}
- {% include "teleforma/inc/conference_list.html" %}
- {% endblock %}
+ {% if type.name == 'Quiz' %}
+ <div class="course_content">
+ {% if course.quiz.all %}
+ <table class="listing" width="100%">
+ <tbody>
+ {% for quiz in course.quiz.all %}
+ <td class="border-top"><a href="{% url quiz_start_page slug=quiz.url %}">{{quiz.title}}</a></td>
+ <td class="border-top">{{quiz.description}}</td>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% else %}
+ <p>Aucun quiz</p>
+ {% endif %}
+ </div>
- {% block media %}
- {% include "teleforma/inc/media_list.html" %}
- {% endblock %}
- {% endif %}
+ {% else %}
+ {% if show_media %}
+ {% block conference %}
+ {% include "teleforma/inc/conference_list.html" %}
+ {% endblock %}
+
+ {% block media %}
+ {% include "teleforma/inc/media_list.html" %}
+ {% endblock %}
+ {% endif %}
- {% block document %}
- {% with forloop.counter as type_counter %}
- {% include "teleforma/inc/document_list.html" %}
- {% endwith %}
- {% endblock %}
+ {% block document %}
+ {% with forloop.counter as type_counter %}
+ {% include "teleforma/inc/document_list.html" %}
+ {% endwith %}
+ {% endblock %}
+ {% endif %}
</div>
{% endfor %}
{% load i18n %}
{% load telemeta_utils %}
{% load teleforma_tags %}
-{% get_googletools as googletools %}
-{% if googletools %}
-{% load googletools %}
-{% endif %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
- <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
-
- <head>
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}><head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
- <meta name="Viewport" content="width=device-width" />
+ <!--<meta name="Viewport" content="width=device-width" />
<meta name="Viewport" content="initial-scale=1.0" />
<meta name="Viewport" content="maximum-scale=1.5" />
- <meta name="Viewport" content="user-scalable=1" />
+ <meta name="Viewport" content="user-scalable=1" />-->
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="icon" href="/static/teleforma/images/favicon.ico"/>
return ' (' + str(len(scripts)) + ')'
else:
return ''
-
+
+ @register.simple_tag
+ def untreated_scripts_count(user, period):
+ return scripts_count(user, period, (3,))
+
@register.simple_tag
def treated_scripts_count(user, period):
- Q1 = Q(status=4, author=user, period=period)
- Q2 = Q(status=4, corrector=user, period=period)
- scripts = Script.objects.filter(Q1 | Q2)
- if scripts:
- return ' (' + str(len(scripts)) + ')'
- else:
- return ''
+ return scripts_count(user, period, (4,))
@register.simple_tag
def get_training_profile(user):
for training in student.trainings.all():
text += unicode(training) + ' '
return text
-
- course = get_object_or_404(Course, id=course_id)
+
+ @register.inclusion_tag('teleforma/inc/newsitems_portlet.html', takes_context=True)
+ def newsitems_portlet(context, course_id, period_id):
+ request = context['request']
+ user = request.user
+ def get_data(newsitem):
+ return {
+ 'id':newsitem.id,
+ 'title':newsitem.title,
+ 'text':newsitem.text,
+ 'creator':newsitem.creator,
+ 'created':newsitem.created,
+ 'can_edit':newsitem.can_edit(request),
+ 'can_delete':newsitem.can_delete(request),
+ }
- can_add = False
++
++ course = get_object_or_404(Course, id=course_id)
+ course_newsitems = [get_data(news) for news in NewsItem.objects.filter(deleted=False, course__id=course_id, period_id=period_id).order_by('-created')]
+ all_newsitems = [get_data(news) for news in NewsItem.objects.filter(deleted=False, period_id=period_id).order_by('-created')]
- 'course_newsitems':course_newsitems,
++ can_add = False
+ if user.is_staff or user.professor.count():
+ can_add = True
+ return {
+ 'can_add':can_add,
+ 'course':course,
+ 'period_id':period_id,
++ 'course_newsitems':course_newsitems,
+ 'all_newsitems':all_newsitems
+ }