Commit 666997e9 by tarokkk

Merge branch 'master' of ssh://giccero.cloud.ik.bme.hu/cloud

parents ce83ea42 13a3166b
...@@ -4,5 +4,6 @@ start on runlevel [2345] ...@@ -4,5 +4,6 @@ start on runlevel [2345]
stop on runlevel [!2345] stop on runlevel [!2345]
respawn respawn
respawn limit 30 30
exec /opt/webadmin/cloud/manage.py runserver 0.0.0.0:8080 exec sudo -u cloud /opt/webadmin/cloud/manage.py runserver 0.0.0.0:8080
...@@ -3,15 +3,14 @@ ...@@ -3,15 +3,14 @@
<title>IK Cloud</title> <title>IK Cloud</title>
<link rel="icon" type="image/png" href="https://cloud.ik.bme.hu/static/favicon.png"> <link rel="icon" type="image/png" href="https://cloud.ik.bme.hu/static/favicon.png">
<link rel="icon" type="image/png" href="https://cloud.ik.bme.hu/one/static/favicon.png"> <link rel="icon" type="image/png" href="https://cloud.ik.bme.hu/one/static/favicon.png">
<link href='http://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'> <link href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed&subset=latin,latin-ext' rel='stylesheet' type='text/css'> <style type="text/css" id="less:static-style">
<link href='http://fonts.googleapis.com/css?family=Ubuntu&subset=latin,latin-ext' rel='stylesheet' type='text/css'> body {
<style type="text/css" id="less:static-style">body { word-spacing: 2px;
word-spacing: 3px;
letter-spacing: 0.5px; letter-spacing: 0.5px;
min-height: 100%; min-height: 100%;
font-family: 'Ubuntu', sans-serif; font-family: 'Titillium Web', sans-serif;
font-size: .9em; font-size: 12pt;
background: #dadada url(https://cloud.ik.bme.hu/static/site_bgr.png) repeat-x; background: #dadada url(https://cloud.ik.bme.hu/static/site_bgr.png) repeat-x;
background-position: 80px 0; background-position: 80px 0;
margin: 0; margin: 0;
...@@ -29,13 +28,15 @@ ...@@ -29,13 +28,15 @@
border: 1px solid #aaa; border: 1px solid #aaa;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.3); box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
margin: 20px; margin: 20px;
text-align: center;
} }
.contentblock p, .contentblock p{
.contentblock dl { margin: 15px;
margin: 0; text-align: justify;
padding: 5px; }
font-size: 1.3em; .contentblock img{
margin: 0px auto;
display: block;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
} }
.contentblock h2 { .contentblock h2 {
background-color: #000; background-color: #000;
...@@ -50,9 +51,6 @@ ...@@ -50,9 +51,6 @@
margin-top: 0; margin-top: 0;
padding: 10px; padding: 10px;
} }
.wm-list {
list-style: none;
}
#header { #header {
height: 80px; height: 80px;
background-color: #072c61; background-color: #072c61;
...@@ -74,355 +72,10 @@ ...@@ -74,355 +72,10 @@
#header h1 a { #header h1 a {
color: #fff; color: #fff;
} }
#loginblock {
position: absolute;
right: 0;
top: 0;
background-color: #000;
background-image: url(https://cloud.ik.bme.hu/static/hexabar.png);
background-position: center center;
border-radius: 0 0 0 10px;
color: #fff;
font-weight: 700;
margin: 0;
padding: 7px;
}
#loginblock a {
color: #fff;
text-decoration: underline;
}
#loginblock a:hover {
color: #aaa;
}
.boxes { .boxes {
width: 480px; width: 480px;
float: left; float: left;
} }
.box {
background-color: #000;
background-image: url(https://cloud.ik.bme.hu/static/hexa.png);
background-position: center 30%;
background-repeat: no-repeat;
color: #fff;
font-weight: 700;
line-height: 1.5em;
width: 400px;
border-radius: 10px;
border-top-width: 30px;
margin: 10px 420px 10px 10px;
padding: 2px;
}
.box h3 {
color: #fff;
text-align: center;
margin: 0;
padding: 3px;
}
.box .content {
min-height: 100px;
margin: 0;
padding: 5px;
}
#new-wm-tooltip {
position: relative;
}
#new-wm-tooltip-container {
margin: 10px 10px 5px 150px;
border-radius: 4px;
border: 1px solid #888;
background: #FFFF66;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}
#new-wm-tooltip-container p {
text-align: left;
font-size: 0.8em;
word-spacing: 2px;
}
#new-wm-tooltip-container:after {
content: "";
position: absolute;
left: 300px;
border-width: 15px;
border-style: solid;
border-color: #FFFF66 transparent transparent transparent;
}
.wm.opened .actions {
display: block !important;
}
.wm .summary {
padding: 15px 5px;
border-top: 1px solid #888;
cursor: pointer;
background-color: #c1c1c1;
}
.wm .summary.unfinished {
background-color: #FFFF66;
}
.wm .summary:hover {
background-color: #b1b1b1;
}
.wm .summary:hover .actions {
display: block;
}
.wm .summary .id {
float: right;
width: 30px;
}
.wm .summary .name {
float: left;
padding-left: 25px;
background-repeat: no-repeat;
background-position: 0 0;
}
.wm .summary .status {
text-align: right;
float: right;
width: 60px;
}
.wm .summary .actions {
float: right;
margin-left: 5px;
display: none;
}
.wm .summary .actions a {
height: 16px;
width: 16px;
display: block;
float: left;
margin-left: 2px;
}
.wm .summary .actions a:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.4);
}
.wm .details {
border-top: 1px solid #888;
background-color: #d1d1d1;
padding: 15px 5px;
display: none;
}
.wm .details h3 {
font-weight: normal;
}
.wm .details ul {
list-style: none;
margin: 10px 3px;
}
.wm .details li {
margin: 12px 0px;
padding: 3px 0px 3px 20px;
border-bottom: 1px dotted #aaa;
background-repeat: no-repeat;
background-position: 0px 4px;
}
.wm .details a {
text-decoration: underline;
}
.wm .details .name {
float: none;
background-image: url(https://cloud.ik.bme.hu/static/icons/computer.png);
}
.wm .details .os-win {
background-image: url(https://cloud.ik.bme.hu/static/icons/windows.png);
}
.wm .details .os-linux {
background-image: url(https://cloud.ik.bme.hu/static/icons/animal-penguin.png);
}
.wm .details .type {
background-image: url(https://cloud.ik.bme.hu/static/icons/box-share.png);
}
.wm .details .date {
background-image: url(https://cloud.ik.bme.hu/static/icons/calendar-day.png);
}
.wm .details .cpu {
background-image: url(https://cloud.ik.bme.hu/static/icons/processor.png);
}
.wm .details .memory {
background-image: url(https://cloud.ik.bme.hu/static/icons/memory.png);
}
.wm .details .count {
background-image: url(https://cloud.ik.bme.hu/static/icons/documents-stack.png);
}
.wm .details .value {
float: right;
width: 200px;
text-align: right;
}
.wm .details .description {
font-size: inherit;
background-image: url(https://cloud.ik.bme.hu/static/icons/document-snippet.png);
}
.wm .details .description .value {
font-size: 0.8em;
}
.wm.opened .details {
display: block;
}
.wm.new .name {
background-image: url(https://cloud.ik.bme.hu/static/icons/computer--plus.png);
}
.file-list {
list-style: none;
}
.file-list .name {
float: left;
}
.file-list .info {
float: right;
width: 60px;
text-align: right;
}
.filetype-c {
background-image: url(https://cloud.ik.bme.hu/static/icons/document-visual-studio.png);
}
.filetype-text {
background-image: url(https://cloud.ik.bme.hu/static/icons/document.png);
}
.filetype-image {
background-image: url(https://cloud.ik.bme.hu/static/icons/document-image.png);
}
.filetype-zip {
background-image: url(https://cloud.ik.bme.hu/static/icons/folder-zipper.png);
}
.filetype-folder {
background-image: url(https://cloud.ik.bme.hu/static/icons/folder-horizontal.png);
}
.filetype-more {
background-image: url(https://cloud.ik.bme.hu/static/icons/arrow-circle-double.png);
}
.filetype-up {
background-image: url(https://cloud.ik.bme.hu/static/icons/upload-cloud.png);
}
.wm-on {
background-image: url(https://cloud.ik.bme.hu/static/icons/computer-cloud.png);
}
.wm-off {
background-image: url(https://cloud.ik.bme.hu/static/icons/computer-off.png);
}
#template .wm .summary .name {
background-image: url(https://cloud.ik.bme.hu/static/icons/document-template.png);
}
#new-template-button .name {
background-image: url(https://cloud.ik.bme.hu/static/icons/document--plus.png) !important;
}
.wm-list.modal {
border-radius: 4px;
border: 1px solid #666;
}
.wm-list.modal input {
padding: 2px 10px;
}
.wm-list.modal .wm:nth-child(1) .summary {
border-top: none;
}
#modal {
position: absolute;
width: 100%;
height: 100%;
}
#shadow {
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
}
#modal-container {
width: 500px;
position: fixed;
left: 50%;
top: 50%;
margin-left: -270px;
margin-top: -200px;
min-height: 200px;
background-color: #fff;
border-radius: 4px;
padding: 20px;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
border: 1px solid #333;
}
#modal-container .container {
max-height: 400px;
overflow: auto;
}
#modal-container ul {
list-style: none;
}
.wizard li {
border-bottom: 1px dotted #999;
}
.wizard label {
float: left;
padding: 5px;
margin: 10px 5px;
}
.wizard h2 {
margin: 10px 0;
}
.wizard .progress {
text-align: center;
}
.wizard .progress .bar {
height: 20px;
background-color: #66c400;
}
.wizard .progress .bar-container {
border: 1px solid #666;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
border-radius: 4px;
height: 20px;
position: absolute;
z-index: -1;
width: 500px;
}
.wizard input[type=text] {
display: block;
float: right;
padding: 5px;
margin: 10px 5px;
width: 200px;
text-align: right;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border: none;
border-radius: 4px;
}
.wizard input:focus {
box-shadow: 0 0 12px #8080ff;
outline: none;
}
.wizard textarea {
float: right;
padding: 5px;
margin: 10px 5px;
width: 300px;
height: 100px;
font-family: 'Ubuntu', sans-serif;
font-size: 12px;
text-align: right;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border: none;
}
.wizard nav a {
text-decoration: underline;
display: block;
}
.wizard nav .prev {
float: left;
}
.wizard nav .next {
float: right;
}
.wizard ul.radio {
float: right;
}
.wizard .radio li {
float: left;
padding: 5px;
margin: 10px 5px;
border-bottom: none !important;
}
.wizard .radio label {
float: none !important;
}
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
...@@ -443,30 +96,16 @@ a:visited { ...@@ -443,30 +96,16 @@ a:visited {
strong { strong {
font-size: .9em; font-size: .9em;
} }
</style> </style>
<!--<script src="./IK Cloud_files/jquery.min.js"></script>-->
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<h1>
<a href="http://cloud.ik.bme.hu/">IK Cloud</a>
</h1>
<h1><a href="http://cloud.ik.bme.hu/">IK Cloud</a></h1>
</div> </div>
<div id="content"> <div id="content">
<div class="boxes">
<div class="boxes">
<div class="contentblock" id="state"> <div class="contentblock" id="state">
<h2>A projektről</h2> <h2>A projektről</h2>
<div> <div>
...@@ -486,10 +125,8 @@ strong { ...@@ -486,10 +125,8 @@ strong {
működő öregedő szerverpark jelentős része.</p> működő öregedő szerverpark jelentős része.</p>
</div> </div>
</div> </div>
</div>
</div> <div class="boxes">
<div class="boxes">
<div class="contentblock" id="state"> <div class="contentblock" id="state">
<h2>Virtuális labor</h2> <h2>Virtuális labor</h2>
<div> <div>
...@@ -504,7 +141,6 @@ strong { ...@@ -504,7 +141,6 @@ strong {
most!</a></p>--> most!</a></p>-->
</div> </div>
</div> </div>
<div class="contentblock" id="state" lang="en"> <div class="contentblock" id="state" lang="en">
<h2>About the project</h2> <h2>About the project</h2>
<div> <div>
...@@ -515,16 +151,8 @@ strong { ...@@ -515,16 +151,8 @@ strong {
</p> </p>
</div> </div>
</div> </div>
</div>
<div class="clear"></div>
</div>
<div id="modal" style="display: none">
<div id="shadow"></div>
<div id="modal-container">
</div> </div>
<div class="clear"></div>
</div> </div>
</body>
</html>
</body></html>
body body
{ {
min-height:100%; min-height:100%;
font-family:'Metrophobic',sans-serif; font-family: 'Titillium Web', sans-serif;
font-size:.9em; font-size:.9em;
background:#dadada url(site_bgr.png) repeat-x; background:#dadada url(site_bgr.png) repeat-x;
background-position:80px 0; background-position:80px 0;
...@@ -47,3 +47,90 @@ body ...@@ -47,3 +47,90 @@ body
.wm-list{ .wm-list{
list-style: none; list-style: none;
} }
ul.messagelist
{
text-align:left;
margin:0;
padding:0 0 5px;
}
ul.messagelist li
{
font-size:12px;
display:block;
border-bottom:1px solid #ddd;
color:#666;
background:#ffc url(admin/img/icon_success.gif) 5px .3em no-repeat;
margin:0 0 3px;
padding:4px 5px 4px 25px;
}
ul.messagelist li.warning
{
background-image:url(admin/img/icon_alert.gif);
}
ul.messagelist li.error
{
background-image:url(admin/img/icon_error.gif);
}
.errornote
{
font-size:12px!important;
display:block;
border:1px solid red;
color:red;
background:#ffc url(admin/img/icon_error.gif) 5px .3em no-repeat;
margin:0 0 3px;
padding:4px 5px 4px 25px;
}
.errorlist li
{
font-size:12px!important;
display:block;
border:1px solid red;
color:#FFF;
background:red url(admin/img/icon_alert.gif) 5px .3em no-repeat;
margin:0 0 3px;
padding:4px 5px 4px 25px;
}
.errorlist li a
{
color:#FFF;
text-decoration:underline;
}
td ul.errorlist li
{
margin:0!important;
}
.errors
{
background:#ffc;
}
.errors input,.errors select,.errors textarea
{
border:1px solid red;
}
div.system-message
{
background:#ffc;
font-size:.8em;
margin:10px;
padding:6px 8px;
}
div.system-message p.system-message-title
{
color:red;
background:#ffc url(admin/img/icon_error.gif) 5px .3em no-repeat;
margin:0;
padding:4px 5px 4px 25px;
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html lang="{{lang}}"> <html lang="{{lang}}">
<head> <head>
<title>{% block title %}IK Cloud{% endblock %}</title> <title>{% block title %}IK Cloud{% endblock %}</title>
<link href='https://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'> <link href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="icon" type="image/png" href="/static/favicon.png" /> <link rel="icon" type="image/png" href="/static/favicon.png" />
<link rel="icon" type="image/png" href="one/static/favicon.png"> <link rel="icon" type="image/png" href="one/static/favicon.png">
<link rel="stylesheet/less" href="/static/style.less" /> <link rel="stylesheet/less" href="/static/style.less" />
......
from django.contrib import messages
from django.core.exceptions import ValidationError
from django import contrib
from django.utils.translation import ugettext_lazy as _
from school import models
import string
class GroupInline(contrib.admin.TabularInline):
model = models.Group
extra = 3
class CourseAdmin(contrib.admin.ModelAdmin):
model = models.Course
inlines = (GroupInline, )
filter_horizontal = ('owners', )
list_display = ('code', 'name', 'short_name', 'owner_list')
list_editable = ('name', 'short_name')
class GroupAdmin(contrib.admin.ModelAdmin):
model = models.Group
filter_horizontal = ('owners', 'members', )
list_display = ('name', 'course', 'semester', 'owner_list', 'member_count')
list_filter = ('semester', 'course')
class SemesterAdmin(contrib.admin.ModelAdmin):
model = models.Semester
list_display = ('id', 'name', 'start', 'end')
list_editable = ('name', 'start', 'end')
contrib.admin.site.register(models.Course, CourseAdmin)
contrib.admin.site.register(models.Semester, SemesterAdmin)
contrib.admin.site.register(models.Group, GroupAdmin)
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Entity'
db.delete_table('school_entity')
# Deleting model 'LessonClass'
db.delete_table('school_lessonclass')
# Deleting model 'Lesson'
db.delete_table('school_lesson')
# Deleting model 'Person'
db.delete_table('school_person')
# Deleting model 'Mark'
db.delete_table('school_mark')
# Deleting model 'Course'
db.delete_table('school_course')
# Deleting model 'Semester'
db.delete_table('school_semester')
# Deleting model 'Event'
db.delete_table('school_event')
# Deleting model 'Attendance'
db.delete_table('school_attendance')
# Deleting model 'Group'
db.delete_table('school_group')
def backwards(self, orm):
# Adding model 'Entity'
db.create_table('school_entity', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Group'])),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
))
db.send_create_signal('school', ['Entity'])
# Adding model 'LessonClass'
db.create_table('school_lessonclass', (
('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Group'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('school', ['LessonClass'])
# Adding model 'Lesson'
db.create_table('school_lesson', (
('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Group'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('lesson_class', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.LessonClass'])),
))
db.send_create_signal('school', ['Lesson'])
# Adding model 'Person'
db.create_table('school_person', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('language', self.gf('django.db.models.fields.CharField')(default='hu', max_length=6)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], unique=True)),
))
db.send_create_signal('school', ['Person'])
# Adding model 'Mark'
db.create_table('school_mark', (
('modified_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='modified_marks', to=orm['school.Person'])),
('value', self.gf('django.db.models.fields.CharField')(max_length=100)),
('student', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Person'])),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('modified_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Event'])),
('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='created_marks', to=orm['school.Person'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
))
db.send_create_signal('school', ['Mark'])
# Adding model 'Course'
db.create_table('school_course', (
('entity_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['school.Entity'], unique=True, primary_key=True)),
))
db.send_create_signal('school', ['Course'])
# Adding model 'Semester'
db.create_table('school_semester', (
('entity_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['school.Entity'], unique=True, primary_key=True)),
('start', self.gf('django.db.models.fields.DateField')()),
('end', self.gf('django.db.models.fields.DateField')()),
))
db.send_create_signal('school', ['Semester'])
# Adding model 'Event'
db.create_table('school_event', (
('type', self.gf('django.db.models.fields.CharField')(max_length=5)),
('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Group'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=100)),
))
db.send_create_signal('school', ['Event'])
# Adding model 'Attendance'
db.create_table('school_attendance', (
('modified_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='modified_attendances', to=orm['school.Person'])),
('modified_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('student', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Person'])),
('lesson', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Lesson'])),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('present', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
))
db.send_create_signal('school', ['Attendance'])
# Adding model 'Group'
db.create_table('school_group', (
('entity_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['school.Entity'], unique=True, primary_key=True)),
('recursive_unique', self.gf('django.db.models.fields.BooleanField')(default=False)),
))
db.send_create_signal('school', ['Group'])
models = {
}
complete_apps = ['school']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Course'
db.create_table('school_course', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=10)),
('name', self.gf('django.db.models.fields.CharField')(max_length=80, null=True, blank=True)),
('default_group', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='default_group_of', null=True, to=orm['school.Group'])),
))
db.send_create_signal('school', ['Course'])
# Adding M2M table for field owners on 'Course'
db.create_table('school_course_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('course', models.ForeignKey(orm['school.course'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_course_owners', ['course_id', 'user_id'])
# Adding model 'Semester'
db.create_table('school_semester', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('start', self.gf('django.db.models.fields.DateField')()),
('end', self.gf('django.db.models.fields.DateField')()),
))
db.send_create_signal('school', ['Semester'])
# Adding model 'Person'
db.create_table('school_person', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], unique=True)),
))
db.send_create_signal('school', ['Person'])
# Adding model 'Group'
db.create_table('school_group', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=80)),
('course', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Course'], null=True, blank=True)),
('semester', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['school.Semester'])),
))
db.send_create_signal('school', ['Group'])
# Adding M2M table for field owners on 'Group'
db.create_table('school_group_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_group_owners', ['group_id', 'user_id'])
# Adding M2M table for field members on 'Group'
db.create_table('school_group_members', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_group_members', ['group_id', 'user_id'])
# Adding unique constraint on 'Group', fields ['name', 'course', 'semester']
db.create_unique('school_group', ['name', 'course_id', 'semester_id'])
def backwards(self, orm):
# Removing unique constraint on 'Group', fields ['name', 'course', 'semester']
db.delete_unique('school_group', ['name', 'course_id', 'semester_id'])
# Deleting model 'Course'
db.delete_table('school_course')
# Removing M2M table for field owners on 'Course'
db.delete_table('school_course_owners')
# Deleting model 'Semester'
db.delete_table('school_semester')
# Deleting model 'Person'
db.delete_table('school_person')
# Deleting model 'Group'
db.delete_table('school_group')
# Removing M2M table for field owners on 'Group'
db.delete_table('school_group_owners')
# Removing M2M table for field members on 'Group'
db.delete_table('school_group_members')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'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'}),
'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'})
},
'school.course': {
'Meta': {'object_name': 'Course'},
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'default_group_of'", 'null': 'True', 'to': "orm['school.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
},
'school.group': {
'Meta': {'unique_together': "(('name', 'course', 'semester'),)", 'object_name': 'Group'},
'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Course']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'members': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'course_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.User']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'owned_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.User']"}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Semester']"})
},
'school.person': {
'Meta': {'object_name': 'Person'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'school.semester': {
'Meta': {'object_name': 'Semester'},
'end': ('django.db.models.fields.DateField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'start': ('django.db.models.fields.DateField', [], {})
}
}
complete_apps = ['school']
\ No newline at end of file
# -*- coding: utf-8 -*-
import 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 'Course.short_name'
db.add_column('school_course', 'short_name',
self.gf('django.db.models.fields.CharField')(max_length=10, null=True, blank=True),
keep_default=False)
# Adding field 'Semester.name'
db.add_column('school_semester', 'name',
self.gf('django.db.models.fields.CharField')(default="semester", unique=True, max_length=20),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Course.short_name'
db.delete_column('school_course', 'short_name')
# Deleting field 'Semester.name'
db.delete_column('school_semester', 'name')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'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'}),
'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'})
},
'school.course': {
'Meta': {'object_name': 'Course'},
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'default_group_of'", 'null': 'True', 'to': "orm['school.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'short_name': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'})
},
'school.group': {
'Meta': {'unique_together': "(('name', 'course', 'semester'),)", 'object_name': 'Group'},
'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Course']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'members': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'course_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.User']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'owned_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.User']"}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Semester']"})
},
'school.person': {
'Meta': {'object_name': 'Person'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'school.semester': {
'Meta': {'object_name': 'Semester'},
'end': ('django.db.models.fields.DateField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'start': ('django.db.models.fields.DateField', [], {})
}
}
complete_apps = ['school']
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field owners on 'Group'
db.delete_table('school_group_owners')
# Removing M2M table for field members on 'Group'
db.delete_table('school_group_members')
# Removing M2M table for field owners on 'Course'
db.delete_table('school_course_owners')
def backwards(self, orm):
# Adding M2M table for field owners on 'Group'
db.create_table('school_group_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_group_owners', ['group_id', 'user_id'])
# Adding M2M table for field members on 'Group'
db.create_table('school_group_members', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_group_members', ['group_id', 'user_id'])
# Adding M2M table for field owners on 'Course'
db.create_table('school_course_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('course', models.ForeignKey(orm['school.course'], null=False)),
('user', models.ForeignKey(orm['auth.user'], null=False))
))
db.create_unique('school_course_owners', ['course_id', 'user_id'])
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'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'}),
'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'})
},
'school.course': {
'Meta': {'object_name': 'Course'},
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'default_group_of'", 'null': 'True', 'to': "orm['school.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'short_name': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'})
},
'school.group': {
'Meta': {'unique_together': "(('name', 'course', 'semester'),)", 'object_name': 'Group'},
'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Course']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Semester']"})
},
'school.person': {
'Meta': {'object_name': 'Person'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'school.semester': {
'Meta': {'object_name': 'Semester'},
'end': ('django.db.models.fields.DateField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'start': ('django.db.models.fields.DateField', [], {})
}
}
complete_apps = ['school']
\ No newline at end of file
# -*- coding: utf-8 -*-
import 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 owners on 'Group'
db.create_table('school_group_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('person', models.ForeignKey(orm['school.person'], null=False))
))
db.create_unique('school_group_owners', ['group_id', 'person_id'])
# Adding M2M table for field members on 'Group'
db.create_table('school_group_members', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('group', models.ForeignKey(orm['school.group'], null=False)),
('person', models.ForeignKey(orm['school.person'], null=False))
))
db.create_unique('school_group_members', ['group_id', 'person_id'])
# Adding M2M table for field owners on 'Course'
db.create_table('school_course_owners', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('course', models.ForeignKey(orm['school.course'], null=False)),
('person', models.ForeignKey(orm['school.person'], null=False))
))
db.create_unique('school_course_owners', ['course_id', 'person_id'])
def backwards(self, orm):
# Removing M2M table for field owners on 'Group'
db.delete_table('school_group_owners')
# Removing M2M table for field members on 'Group'
db.delete_table('school_group_members')
# Removing M2M table for field owners on 'Course'
db.delete_table('school_course_owners')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'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'}),
'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'})
},
'school.course': {
'Meta': {'object_name': 'Course'},
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '10'}),
'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'default_group_of'", 'null': 'True', 'to': "orm['school.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['school.Person']", 'null': 'True', 'blank': 'True'}),
'short_name': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'})
},
'school.group': {
'Meta': {'unique_together': "(('name', 'course', 'semester'),)", 'object_name': 'Group'},
'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Course']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'members': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'course_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['school.Person']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'owned_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['school.Person']"}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Semester']"})
},
'school.person': {
'Meta': {'object_name': 'Person'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'school.semester': {
'Meta': {'object_name': 'Semester'},
'end': ('django.db.models.fields.DateField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'start': ('django.db.models.fields.DateField', [], {})
}
}
complete_apps = ['school']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Course.code'
db.alter_column('school_course', 'code', self.gf('django.db.models.fields.CharField')(unique=True, max_length=20))
def backwards(self, orm):
# Changing field 'Course.code'
db.alter_column('school_course', 'code', self.gf('django.db.models.fields.CharField')(max_length=10, unique=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'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', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'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', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'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'}),
'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'})
},
'school.course': {
'Meta': {'object_name': 'Course'},
'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'default_group': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'default_group_of'", 'null': 'True', 'to': "orm['school.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['school.Person']", 'null': 'True', 'blank': 'True'}),
'short_name': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'})
},
'school.group': {
'Meta': {'unique_together': "(('name', 'course', 'semester'),)", 'object_name': 'Group'},
'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Course']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'members': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'course_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['school.Person']"}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'owners': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'owned_groups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['school.Person']"}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['school.Semester']"})
},
'school.person': {
'Meta': {'object_name': 'Person'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
},
'school.semester': {
'Meta': {'object_name': 'Semester'},
'end': ('django.db.models.fields.DateField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'start': ('django.db.models.fields.DateField', [], {})
}
}
complete_apps = ['school']
\ No newline at end of file
...@@ -2,63 +2,121 @@ from django.db import models ...@@ -2,63 +2,121 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.core.exceptions import ValidationError
from datetime import datetime
def create_user_profile(sender, instance, created, **kwargs): def create_user_profile(sender, instance, created, **kwargs):
if created: if created:
try:
Person.objects.create(user=instance) Person.objects.create(user=instance)
except:
pass
post_save.connect(create_user_profile, sender=User) post_save.connect(create_user_profile, sender=User)
LANGS = [('hu', _('Hungarian')), ('en_US', _('US English'))]
class Person(models.Model): class Person(models.Model):
user = models.ForeignKey(User, null=False, blank=False, unique=True) user = models.ForeignKey(User, null=False, blank=False, unique=True)
language = models.CharField(max_length=6, choices=LANGS, default='hu',
verbose_name=_('Preferred language'))
def __unicode__(self): def short_name(self):
return self.user.__unicode__() if self.user.last_name:
return self.user.last_name
else:
return self.user.username
class Entity(models.Model): def __unicode__(self):
parent = models.ForeignKey('school.Group') u = self.user
name = models.CharField(max_length=100) if not u:
return unicode(_("(none)"))
if u.last_name and u.first_name:
return _("%(first)s %(last)s") % {'first': u.first_name,
'last': u.last_name}
else:
return u.username
class Course(models.Model):
code = models.CharField(max_length=20, unique=True)
name = models.CharField(max_length=80, null=True, blank=True)
short_name = models.CharField(max_length=10, null=True, blank=True)
default_group = models.ForeignKey('Group', null=True, blank=True,
related_name='default_group_of')
owners = models.ManyToManyField(Person, blank=True, null=True)
def get_or_create_default_group(self):
if self.default_group:
return self.default_group
else:
default_group = Group(name=_("%s -- default") % self.short(),
semester=Semester.get_current(), course=self)
default_group.save()
self.default_group_id = default_group.id
self.save()
return default_group
def save(self, *args, **kwargs):
if self.default_group:
self.default_group.course = self
self.default_group.save()
self.full_clean()
super(Course, self).save(*args, **kwargs)
class Group(Entity): def __unicode__(self):
recursive_unique = models.BooleanField() if self.short_name:
return u"%s (%s)" % (self.code, self.name)
else:
return self.code
def short(self):
if self.short_name:
return self.short_name
else:
return self.code
def owner_list(self):
if self.owners:
return ", ".join([p.short_name() for p in self.owners.all()])
else:
return _("n/a")
class Course(Entity):
pass
class Semester(Entity): class Semester(models.Model):
name = models.CharField(max_length=20, unique=True, null=False)
start = models.DateField() start = models.DateField()
end = models.DateField() end = models.DateField()
EVENT_CHOICES = [('free', _('free text')), ('num', _('number')), ('int', _('integer'))] def is_on(self, time):
class Event(models.Model): return self.start <= time.date() and self.end >= time.date()
title = models.CharField(max_length=100)
group = models.ForeignKey('school.Group') @classmethod
type = models.CharField(max_length=5, choices=EVENT_CHOICES) def get_current(cls):
n = datetime.now()
class Mark(models.Model): current = [s for s in Semester.objects.all() if s.is_on(n)]
value = models.CharField(max_length=100) try:
student = models.ForeignKey('Person') return current[0]
event = models.ForeignKey('school.Event') except:
created_by = models.ForeignKey('Person', related_name='created_marks') raise ValidationError(_('There is no current semester.'))
created_at = models.DateTimeField(auto_now_add=True)
modified_by = models.ForeignKey('Person', related_name='modified_marks') def __unicode__(self):
modified_at = models.DateTimeField(auto_now=True) return self.name
class Attendance(models.Model):
present = models.NullBooleanField()
student = models.ForeignKey('Person') class Group(models.Model):
lesson = models.ForeignKey('school.Lesson') name = models.CharField(max_length=80, unique=True)
modified_by = models.ForeignKey('Person', course = models.ForeignKey('Course', null=True, blank=True)
related_name='modified_attendances') semester = models.ForeignKey('Semester', null=False, blank=False)
modified_at = models.DateTimeField(auto_now=True) owners = models.ManyToManyField(Person, blank=True, null=True, related_name='owned_groups')
members = models.ManyToManyField(Person, blank=True, null=True, related_name='course_groups')
class LessonClass(models.Model):
group = models.ForeignKey('school.Group') class Meta:
unique_together = (('name', 'course', 'semester', ), )
class Lesson(models.Model):
lesson_class = models.ForeignKey('school.LessonClass') def owner_list(self):
group = models.ForeignKey('school.Group') if self.owners:
return ", ".join([p.short_name() for p in self.owners.all()])
else:
return _("n/a")
def member_count(self):
return self.members.count()
def __unicode__(self):
if self.course:
return "%s (%s)" % (self.name, self.course.short())
else:
return "%s (%s)" % (self.name, self.owner_list())
from datetime import datetime from datetime import datetime
from django.core.exceptions import ValidationError
from django.conf import settings from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User from django.contrib.auth.models import User, Group as AGroup
from django.contrib import messages from django.contrib import messages
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.core import signing from django.core import signing
...@@ -9,7 +10,6 @@ from django.core.mail import mail_managers, send_mail ...@@ -9,7 +10,6 @@ from django.core.mail import mail_managers, send_mail
from django.db import transaction from django.db import transaction
from django.forms import ModelForm, Textarea from django.forms import ModelForm, Textarea
from django.http import Http404 from django.http import Http404
#from django_shibboleth.forms import BaseRegisterForm
from django.shortcuts import render, render_to_response, get_object_or_404, redirect from django.shortcuts import render, render_to_response, get_object_or_404, redirect
from django.template import RequestContext from django.template import RequestContext
from django.template.loader import render_to_string from django.template.loader import render_to_string
...@@ -20,65 +20,92 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -20,65 +20,92 @@ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import * from django.views.decorators.http import *
from django.views.generic import * from django.views.generic import *
from one.models import * from one.models import *
from school.models import *
import django.contrib.auth as auth import django.contrib.auth as auth
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
SHIB_ATTRIBUTE_MAP = {
"HTTP_SHIB_IDENTITY_PROVIDER": (True, "idp"),
"email": (True, "email"),
"sn": (True, "sn"),
"givenName": (True, "givenName"),
"niifPersonOrgID": (True, "niifPersonOrgID"),
}
def parse_attributes(META):
shib_attrs = {}
error = False
for header, attr in SHIB_ATTRIBUTE_MAP.items():
required, name = attr
values = META.get(header, None)
value = None
if values:
# If multiple attributes releases just care about the 1st one
try:
value = values.split(';')[0]
except:
value = values
shib_attrs[name] = value
if not value or value == '':
if required:
error = True
return shib_attrs, error
def logout(request): def logout(request):
auth.logout(request) auth.logout(request)
return redirect('/Shibboleth.sso/Logout?return=https%3a%2f%2fcloud.ik.bme.hu%2f') return redirect('/Shibboleth.sso/Logout?return=https%3a%2f%2fcloud.ik.bme.hu%2f')
def login(request): def login(request):
attr, error = parse_attributes(request.META) try:
if not attr['niifPersonOrgID']: user = User.objects.get(username=request.META['niifPersonOrgID'])
except KeyError:
messages.error(request, _('EduID is not available.')) messages.error(request, _('EduID is not available.'))
return redirect('/admin') return redirect('/admin')
try:
user = User.objects.get(username=attr['niifPersonOrgID'])
except User.DoesNotExist: except User.DoesNotExist:
user = User(username=attr['niifPersonOrgID']) user = User(username=request.META['niifPersonOrgID'])
user.set_unusable_password() user.set_unusable_password()
user.first_name = attr['givenName'] user.first_name = request.META['givenName']
user.last_name = attr['sn'] user.last_name = request.META['sn']
user.email = attr['email'] user.email = request.META['email']
user.save()
p, created = Person.objects.get_or_create(user=user)
p.save()
try:
sem = Semester.get_current()
attended = request.META['HTTP_NIIFEDUPERSONATTENDEDCOURSE']
if attended == '':
attended = []
else:
attended = attended.split(';')
for c in attended:
try:
co = Course.objects.get(code=c)
except:
continue
g = co.get_or_create_default_group()
if p.course_groups.filter(semester=sem, course=co).count() == 0:
try:
g.members.add(p)
g.save()
messages.info(request, _('Course "%s" added.') % g.course)
except Exception as e:
logger.warning("Django ex %s" % e)
except ValidationError as e:
logger.warning("Django ex4 %s" % e)
held = request.META['HTTP_NIIFEDUPERSONHELDCOURSE']
if held == '':
held = []
else:
held = held.split(';')
for c in held:
co, created = Course.objects.get_or_create(code=c)
if created:
logger.warning("django Course %s created" % c)
g = co.get_or_create_default_group()
try:
co.owners.add(p)
g.owners.add(p)
messages.info(request, _('Course "%s" ownership added.') % g.course)
except Exception as e:
logger.warning("Django ex %s" % e)
co.save()
g.save()
affiliation = request.META['affiliation']
if affiliation == '':
affiliation = []
else:
affiliation = affiliation.split(';')
for a in affiliation:
g, created = AGroup.objects.get_or_create(name=a)
user.groups.add(g)
user.save() user.save()
p.save()
user.backend = 'django.contrib.auth.backends.ModelBackend' user.backend = 'django.contrib.auth.backends.ModelBackend'
auth.login(request, user) auth.login(request, user)
logger.warning("Shib login with %s" % request.META) logger.warning("Shib login with %s" % request.META)
redirect_to = request.REQUEST.get(auth.REDIRECT_FIELD_NAME, '') redirect_to = request.REQUEST.get(auth.REDIRECT_FIELD_NAME, '')
if not is_safe_url(url=redirect_to, host=request.get_host()): if not is_safe_url(url=redirect_to, host=request.get_host()):
redirect_to = settings.LOGIN_REDIRECT_URL redirect_to = settings.LOGIN_REDIRECT_URL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment