arbiters etc.
authorJan Szejko <janek37@gmail.com>
Wed, 11 Jan 2017 12:49:11 +0000 (13:49 +0100)
committerJan Szejko <janek37@gmail.com>
Wed, 11 Jan 2017 12:49:11 +0000 (13:49 +0100)
12 files changed:
edumed/settings/apps.py
edumed/settings/custom.py
edumed/templates/registration/login.html [new file with mode: 0644]
edumed/urls.py
stage2/migrations/0006_auto__add_field_assignment_content_url.py [new file with mode: 0644]
stage2/migrations/0007_auto.py [new file with mode: 0644]
stage2/migrations/0008_auto__add_field_answer_need_arbiter.py [new file with mode: 0644]
stage2/models.py
stage2/templates/stage2/answer_list.html
stage2/templates/stage2/participant.html
stage2/urls.py
stage2/views.py

index 8b64c7c..0234807 100644 (file)
@@ -13,7 +13,7 @@ INSTALLED_APPS = (
     'fnpdjango',
     'south',
     'pipeline',
     'fnpdjango',
     'south',
     'pipeline',
-    'django_extensions',
+    'django_extensions',
     # Disable, if not using Piwik.
     'piwik',
     # Disable, if not using CAS.
     # Disable, if not using Piwik.
     'piwik',
     # Disable, if not using CAS.
index 65d5ed3..fc95db1 100644 (file)
@@ -2,4 +2,4 @@
 
 CONTACT_FORMS_MODULE = 'edumed.contact_forms'
 
 
 CONTACT_FORMS_MODULE = 'edumed.contact_forms'
 
-MAX_UPLOAD_SIZE = 10485760  # 10 MB
+MAX_UPLOAD_SIZE = 20 * 1024 * 1024
diff --git a/edumed/templates/registration/login.html b/edumed/templates/registration/login.html
new file mode 100644 (file)
index 0000000..4d8416d
--- /dev/null
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+
+{% block body %}
+  <form method="post">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <button>Zaloguj się</button>
+  </form>
+{% endblock %}
\ No newline at end of file
index 0e5c295..0bc3091 100644 (file)
@@ -53,6 +53,12 @@ if 'django_cas' in settings.INSTALLED_APPS:
         url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
         url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
     )
         url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
         url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
     )
+else:
+    from django.contrib.auth.views import login, logout
+    urlpatterns += (
+        url(r'^accounts/login/$', login, name='login'),
+        url(r'^accounts/logout/$', logout, name='logout'),
+    )
 
 urlpatterns += (
     url(r'^(?P<url>[^/]*/|)$',
 
 urlpatterns += (
     url(r'^(?P<url>[^/]*/|)$',
@@ -60,8 +66,7 @@ urlpatterns += (
 )
 
 if settings.DEBUG:
 )
 
 if settings.DEBUG:
-    urlpatterns += patterns(
-        '',
+    urlpatterns += (
         # url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
         #     'document_root': settings.MEDIA_ROOT,
         # }),
         # url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
         #     'document_root': settings.MEDIA_ROOT,
         # }),
diff --git a/stage2/migrations/0006_auto__add_field_assignment_content_url.py b/stage2/migrations/0006_auto__add_field_assignment_content_url.py
new file mode 100644 (file)
index 0000000..39d811e
--- /dev/null
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Assignment.content_url'
+        db.add_column(u'stage2_assignment', 'content_url',
+                      self.gf('django.db.models.fields.URLField')(default='', max_length=200),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Assignment.content_url'
+        db.delete_column(u'stage2_assignment', 'content_url')
+
+
+    models = {
+        u'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'auth.permission': {
+            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        u'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        u'contact.contact': {
+            'Meta': {'ordering': "('-created_at',)", 'object_name': 'Contact'},
+            'body': ('jsonfield.fields.JSONField', [], {}),
+            'contact': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'form_tag': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'})
+        },
+        u'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        u'stage2.answer': {
+            'Meta': {'unique_together': "(['participant', 'assignment'],)", 'object_name': 'Answer'},
+            'assignment': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Assignment']"}),
+            'complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'participant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Participant']"})
+        },
+        u'stage2.assignment': {
+            'Meta': {'ordering': "['deadline', 'title']", 'object_name': 'Assignment'},
+            'content': ('django.db.models.fields.TextField', [], {}),
+            'content_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+            'deadline': ('django.db.models.fields.DateTimeField', [], {}),
+            'experts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'stage2_assignments'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
+            'file_descriptions': ('jsonfield.fields.JSONField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'max_points': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '128'})
+        },
+        u'stage2.attachment': {
+            'Meta': {'ordering': "['file_no']", 'object_name': 'Attachment'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+            'file_no': ('django.db.models.fields.IntegerField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+        },
+        u'stage2.mark': {
+            'Meta': {'unique_together': "(['expert', 'answer'],)", 'object_name': 'Mark'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'expert': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'points': ('django.db.models.fields.DecimalField', [], {'max_digits': '3', 'decimal_places': '1'})
+        },
+        u'stage2.participant': {
+            'Meta': {'object_name': 'Participant'},
+            'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contact.Contact']", 'null': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '100'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+            'key_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        }
+    }
+
+    complete_apps = ['stage2']
\ No newline at end of file
diff --git a/stage2/migrations/0007_auto.py b/stage2/migrations/0007_auto.py
new file mode 100644 (file)
index 0000000..e05e4e1
--- /dev/null
@@ -0,0 +1,117 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding M2M table for field arbiters on 'Assignment'
+        m2m_table_name = db.shorten_name(u'stage2_assignment_arbiters')
+        db.create_table(m2m_table_name, (
+            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+            ('assignment', models.ForeignKey(orm[u'stage2.assignment'], null=False)),
+            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
+        ))
+        db.create_unique(m2m_table_name, ['assignment_id', 'user_id'])
+
+
+    def backwards(self, orm):
+        # Removing M2M table for field arbiters on 'Assignment'
+        db.delete_table(db.shorten_name(u'stage2_assignment_arbiters'))
+
+
+    models = {
+        u'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'auth.permission': {
+            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        u'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        u'contact.contact': {
+            'Meta': {'ordering': "('-created_at',)", 'object_name': 'Contact'},
+            'body': ('jsonfield.fields.JSONField', [], {}),
+            'contact': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'form_tag': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'})
+        },
+        u'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        u'stage2.answer': {
+            'Meta': {'unique_together': "(['participant', 'assignment'],)", 'object_name': 'Answer'},
+            'assignment': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Assignment']"}),
+            'complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'participant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Participant']"})
+        },
+        u'stage2.assignment': {
+            'Meta': {'ordering': "['deadline', 'title']", 'object_name': 'Assignment'},
+            'arbiters': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'stage2_arbitrated'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
+            'content': ('django.db.models.fields.TextField', [], {}),
+            'content_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+            'deadline': ('django.db.models.fields.DateTimeField', [], {}),
+            'experts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'stage2_assignments'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
+            'file_descriptions': ('jsonfield.fields.JSONField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'max_points': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '128'})
+        },
+        u'stage2.attachment': {
+            'Meta': {'ordering': "['file_no']", 'object_name': 'Attachment'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+            'file_no': ('django.db.models.fields.IntegerField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+        },
+        u'stage2.mark': {
+            'Meta': {'unique_together': "(['expert', 'answer'],)", 'object_name': 'Mark'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'expert': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'points': ('django.db.models.fields.DecimalField', [], {'max_digits': '3', 'decimal_places': '1'})
+        },
+        u'stage2.participant': {
+            'Meta': {'object_name': 'Participant'},
+            'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contact.Contact']", 'null': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '100'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+            'key_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        }
+    }
+
+    complete_apps = ['stage2']
\ No newline at end of file
diff --git a/stage2/migrations/0008_auto__add_field_answer_need_arbiter.py b/stage2/migrations/0008_auto__add_field_answer_need_arbiter.py
new file mode 100644 (file)
index 0000000..641c87e
--- /dev/null
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Answer.need_arbiter'
+        db.add_column(u'stage2_answer', 'need_arbiter',
+                      self.gf('django.db.models.fields.BooleanField')(default=False),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Answer.need_arbiter'
+        db.delete_column(u'stage2_answer', 'need_arbiter')
+
+
+    models = {
+        u'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'auth.permission': {
+            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        u'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        u'contact.contact': {
+            'Meta': {'ordering': "('-created_at',)", 'object_name': 'Contact'},
+            'body': ('jsonfield.fields.JSONField', [], {}),
+            'contact': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'form_tag': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'})
+        },
+        u'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        u'stage2.answer': {
+            'Meta': {'unique_together': "(['participant', 'assignment'],)", 'object_name': 'Answer'},
+            'assignment': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Assignment']"}),
+            'complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'need_arbiter': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'participant': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Participant']"})
+        },
+        u'stage2.assignment': {
+            'Meta': {'ordering': "['deadline', 'title']", 'object_name': 'Assignment'},
+            'arbiters': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'stage2_arbitrated'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
+            'content': ('django.db.models.fields.TextField', [], {}),
+            'content_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+            'deadline': ('django.db.models.fields.DateTimeField', [], {}),
+            'experts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'stage2_assignments'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
+            'file_descriptions': ('jsonfield.fields.JSONField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'max_points': ('django.db.models.fields.IntegerField', [], {}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '128'})
+        },
+        u'stage2.attachment': {
+            'Meta': {'ordering': "['file_no']", 'object_name': 'Attachment'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+            'file_no': ('django.db.models.fields.IntegerField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+        },
+        u'stage2.mark': {
+            'Meta': {'unique_together': "(['expert', 'answer'],)", 'object_name': 'Mark'},
+            'answer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['stage2.Answer']"}),
+            'expert': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'points': ('django.db.models.fields.DecimalField', [], {'max_digits': '3', 'decimal_places': '1'})
+        },
+        u'stage2.participant': {
+            'Meta': {'object_name': 'Participant'},
+            'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contact.Contact']", 'null': 'True'}),
+            'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '100'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
+            'key_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        }
+    }
+
+    complete_apps = ['stage2']
\ No newline at end of file
index 38e0f19..81625b9 100644 (file)
@@ -59,9 +59,11 @@ class Participant(models.Model):
 class Assignment(models.Model):
     title = models.CharField(_('title'), max_length=128)
     content = models.TextField(_('content'))
 class Assignment(models.Model):
     title = models.CharField(_('title'), max_length=128)
     content = models.TextField(_('content'))
+    content_url = models.URLField(_('URL'))
     deadline = models.DateTimeField(_('deadline'))
     max_points = models.IntegerField(_('max points'))
     experts = models.ManyToManyField(User, verbose_name=_('experts'), related_name='stage2_assignments')
     deadline = models.DateTimeField(_('deadline'))
     max_points = models.IntegerField(_('max points'))
     experts = models.ManyToManyField(User, verbose_name=_('experts'), related_name='stage2_assignments')
+    arbiters = models.ManyToManyField(User, verbose_name=_('arbiters'), related_name='stage2_arbitrated')
     file_descriptions = JSONField(_('file descriptions'))
 
     class Meta:
     file_descriptions = JSONField(_('file descriptions'))
 
     class Meta:
@@ -73,7 +75,10 @@ class Assignment(models.Model):
         return self.title
 
     def available_answers(self, expert):
         return self.title
 
     def available_answers(self, expert):
-        return self.answer_set.exclude(mark__expert=expert).exclude(complete=True)
+        answers = self.answer_set.exclude(mark__expert=expert).exclude(complete=True)
+        if expert in self.arbiters.all():
+            answers = answers.filter(need_arbiter=True)
+        return answers
 
     def is_active(self):
         return self.deadline >= timezone.now()
 
     def is_active(self):
         return self.deadline >= timezone.now()
@@ -84,6 +89,7 @@ class Answer(models.Model):
     assignment = models.ForeignKey(Assignment)
     # useful redundancy
     complete = models.BooleanField(default=False)
     assignment = models.ForeignKey(Assignment)
     # useful redundancy
     complete = models.BooleanField(default=False)
+    need_arbiter = models.BooleanField(default=False)
 
     class Meta:
         unique_together = ['participant', 'assignment']
 
     class Meta:
         unique_together = ['participant', 'assignment']
@@ -92,12 +98,16 @@ class Answer(models.Model):
         marks = self.mark_set.all()
         if len(marks) < 2:
             complete = False
         marks = self.mark_set.all()
         if len(marks) < 2:
             complete = False
+            need_arbiter = False
         elif len(marks) == 2:
             mark1, mark2 = marks
             complete = abs(mark1.points - mark2.points) < 0.2 * self.assignment.max_points
         elif len(marks) == 2:
             mark1, mark2 = marks
             complete = abs(mark1.points - mark2.points) < 0.2 * self.assignment.max_points
+            need_arbiter = not complete
         else:
             complete = True
         else:
             complete = True
+            need_arbiter = False
         self.complete = complete
         self.complete = complete
+        self.need_arbiter = need_arbiter
         self.save()
 
     def score(self):
         self.save()
 
     def score(self):
index aa00891..8a3cf3c 100644 (file)
@@ -3,7 +3,7 @@
 
 {% block body %}
   <h1>{% if marked %}Ocenione odpowiedzi{% else %}Odpowiedzi do oceny{% endif %}</h1>
 
 {% block body %}
   <h1>{% if marked %}Ocenione odpowiedzi{% else %}Odpowiedzi do oceny{% endif %}</h1>
-  <p>Zadanie <cite>{{ assignment.title }}</cite> (max {{ assignment.max_points }} pkt)</p>
+  <h2>{{ assignment.title }} (max {{ assignment.max_points }} pkt)</h2>
   <p><strong>{% if assignment.is_active %}Możliwość oceniania zostanie włączona po terminie wysyłania rozwiązań</strong>{% endif %}</p>
   {% if not assignment.is_active %}
     {% if marked %}
   <p><strong>{% if assignment.is_active %}Możliwość oceniania zostanie włączona po terminie wysyłania rozwiązań</strong>{% endif %}</p>
   {% if not assignment.is_active %}
     {% if marked %}
index ec481f8..64a6a1a 100644 (file)
@@ -11,9 +11,7 @@
 
   {% for assignment in assignments %}
     <h2>{{ assignment.title }} (do {{ assignment.deadline }})</h2>
 
   {% for assignment in assignments %}
     <h2>{{ assignment.title }} (do {{ assignment.deadline }})</h2>
-    {% if assignment.is_active %}
-      <p>{{ assignment.content|textile_pl }}</p>
-    {% endif %}
+    <a href="{{ assignment.content_url }}"><strong>Zobacz treść zadania</strong></a>
     <form method="POST" action="{% url 'stage2_upload' assignment.id participant.id participant.key %}"
           enctype="multipart/form-data">
       {% csrf_token %}
     <form method="POST" action="{% url 'stage2_upload' assignment.id participant.id participant.key %}"
           enctype="multipart/form-data">
       {% csrf_token %}
@@ -29,7 +27,7 @@
           {% endif %}
         </p>
       {% endfor %}
           {% endif %}
         </p>
       {% endfor %}
-      <input type="submit" value="Wyślij"/>
+      {% if assignment.is_active %}<input type="submit" value="Wyślij"/>{% endif %}
     </form>
   {% endfor %}
 
     </form>
   {% endfor %}
 
index 925a968..081c2b0 100644 (file)
@@ -10,8 +10,8 @@ urlpatterns = (
     url(r'^plik/(?P<assignment_id>[0-9]*)/(?P<file_no>[0-9]*)/(?P<participant_id>[0-9]*)/(?P<key>.*)/$',
         views.get_file, name='stage2_participant_file'),
     url(r'^zadania/$', views.assignment_list, name='stage2_assignments'),
     url(r'^plik/(?P<assignment_id>[0-9]*)/(?P<file_no>[0-9]*)/(?P<participant_id>[0-9]*)/(?P<key>.*)/$',
         views.get_file, name='stage2_participant_file'),
     url(r'^zadania/$', views.assignment_list, name='stage2_assignments'),
-    url(r'^odpowiedzi/(?P<assignment_id>[0-9]*)/$', views.answer_list, name='stage2_answer_list'),
-    url(r'^ocenione/(?P<assignment_id>[0-9]*)/$', views.marked_answer_list, name='stage2_marked_answers'),
+    url(r'^zadania/(?P<assignment_id>[0-9]*)/$', views.answer_list, name='stage2_answer_list'),
+    url(r'^zadania/(?P<assignment_id>[0-9]*)/ocenione/$', views.marked_answer_list, name='stage2_marked_answers'),
     url(r'^plik/(?P<attachment_id>[0-9]*)/$', views.expert_download, name='stage2_expert_download'),
     url(r'^mark/(?P<answer_id>[0-9]*)/$', views.mark_answer, name='stage2_mark_answer'),
 )
     url(r'^plik/(?P<attachment_id>[0-9]*)/$', views.expert_download, name='stage2_expert_download'),
     url(r'^mark/(?P<answer_id>[0-9]*)/$', views.mark_answer, name='stage2_mark_answer'),
 )
index c3e3eb7..974e375 100644 (file)
@@ -76,11 +76,12 @@ def assignment_list(request):
     assignments = request.user.stage2_assignments.all()
     if not assignments:
         return HttpResponseForbidden()
     assignments = request.user.stage2_assignments.all()
     if not assignments:
         return HttpResponseForbidden()
-    if len(assignments) == 1:
-        return HttpResponseRedirect(reverse('stage2_answer_list', args=[assignments.get().id]))
     for assignment in assignments:
         assignment.marked_count = Mark.objects.filter(expert=request.user, answer__assignment=assignment).count()
         assignment.to_mark_count = assignment.available_answers(request.user).count()
     for assignment in assignments:
         assignment.marked_count = Mark.objects.filter(expert=request.user, answer__assignment=assignment).count()
         assignment.to_mark_count = assignment.available_answers(request.user).count()
+    non_empty_assignments = [ass for ass in assignments if ass.marked_count > 0 or ass.to_mark_count > 0]
+    if len(non_empty_assignments) == 1 and non_empty_assignments[0].to_mark_count > 0:
+        return HttpResponseRedirect(reverse('stage2_answer_list', args=[non_empty_assignments[0].id]))
     return render(request, 'stage2/assignment_list.html', {'assignments': assignments})
 
 
     return render(request, 'stage2/assignment_list.html', {'assignments': assignments})