Extend image fields size to 200 characters + minor bugs
authorverrierj
Mon, 09 Jan 2012 12:44:15 +0100
changeset 342 17d615b49a91
parent 341 9d74fc6c3244
child 343 1b9b509013a7
Extend image fields size to 200 characters + minor bugs
src/ldt/ldt/ldt_utils/migrations/0011_auto__chg_field_content_image__chg_field_project_image.py
src/ldt/ldt/ldt_utils/models.py
src/ldt/ldt/ldt_utils/stat.py
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html
src/ldt/ldt/ldt_utils/views/workspace.py
src/ldt/ldt/user/forms.py
src/ldt/ldt/user/migrations/0006_auto__add_field_userprofile_image.py
src/ldt/ldt/user/migrations/0007_auto__add_groupprofile.py
src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py
src/ldt/ldt/user/models.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/migrations/0011_auto__chg_field_content_image__chg_field_project_image.py	Mon Jan 09 12:44:15 2012 +0100
@@ -0,0 +1,144 @@
+# encoding: 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 'Content.image'
+        db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+        # Changing field 'Project.image'
+        db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+
+    def backwards(self, orm):
+        
+        # Changing field 'Content.image'
+        db.alter_column('ldt_utils_content', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+        # Changing field 'Project.image'
+        db.alter_column('ldt_utils_project', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+
+    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'})
+        },
+        'ldt_utils.author': {
+            'Meta': {'object_name': 'Author'},
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+            'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'handle': ('django.db.models.fields.CharField', [], {'max_length': '512', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.content': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Content'},
+            'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}),
+            'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/contents/content_default_icon.png'", 'max_length': '200'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'2794e921-3aa9-11e1-844e-001485352c9a'", 'unique': 'True', 'max_length': '1024'}),
+            'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}),
+            'nb_annotation': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'stat_annotation': ('django.db.models.fields.CommaSeparatedIntegerField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.media': {
+            'Meta': {'object_name': 'Media'},
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'src': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.project': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Project'},
+            'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}),
+            'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/projects/project_default_icon.png'", 'max_length': '200'}),
+            'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+            'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+            'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
+        },
+        'ldt_utils.segment': {
+            'Meta': {'unique_together': "(('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)", 'object_name': 'Segment'},
+            'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}),
+            'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'project_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}),
+            'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['ldt_utils']
--- a/src/ldt/ldt/ldt_utils/models.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/models.py	Mon Jan 09 12:44:15 2012 +0100
@@ -127,7 +127,7 @@
     content_creation_date = models.DateTimeField(null=True, blank=True, verbose_name=_('content.content_creation_date'))
     tags = tagging.fields.TagField(max_length=2048, null=True, blank=True)
     media_obj = models.ForeignKey('Media', blank=True, null=True)
-    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/contents/", default=settings.DEFAULT_CONTENT_ICON)
+    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/contents/", default=settings.DEFAULT_CONTENT_ICON, max_length=200)
     stat_annotation = models.CommaSeparatedIntegerField(max_length=1024, null=True, blank=True, verbose_name=_("content.stat_annotation")) 
     nb_annotation = models.IntegerField(null=True, blank=True, verbose_name=_('content.nb_annotation'))
         
@@ -334,6 +334,12 @@
         return locals()
     
     is_public = property(**is_public())
+    
+    def annotations(self):
+        
+        
+        
+        return []
 
     
 class Project(Document, SafeModel):  
@@ -353,9 +359,8 @@
     created_by = models.CharField(_("created by"), max_length=70)
     changed_by = models.CharField(_("changed by"), max_length=70)
     state = models.IntegerField(choices=STATE_CHOICES, default=1)
-    description = models.TextField(null=True, blank=True)
-    
-    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/projects/", default=settings.DEFAULT_PROJECT_ICON)
+    description = models.TextField(null=True, blank=True)    
+    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/projects/", default=settings.DEFAULT_PROJECT_ICON, max_length=200)
     
     class Meta:
         ordering = ["title"]
--- a/src/ldt/ldt/ldt_utils/stat.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/stat.py	Mon Jan 09 12:44:15 2012 +0100
@@ -68,6 +68,11 @@
 def add_annotation_to_stat(content, begin, end):
     stats = content.stat_annotation
     
+    if not content.nb_annotation:
+        content.nb_annotation = 1
+    else:
+        content.nb_annotation += 1
+    
     if stats:
         
         number_division = settings.DIVISIONS_FOR_STAT_ANNOTATION
@@ -78,10 +83,8 @@
         
         buckets = find_buckets(buckets, limits, begin, end)
         content.stat_annotation = get_string_from_buckets(buckets)
-        content.nb_annotation += 1
-        content.save()    
-    else:
-        return None   
+    
+    content.save()    
 
     
 
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Mon Jan 09 12:44:15 2012 +0100
@@ -30,10 +30,8 @@
 	<script type="text/javascript">
 	window.__admin_media_prefix__ = "{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}";
 	
-	function public_checkbox (checkbox) {		
-		if (checkbox.is(":checked")) {
-			$("#removeall").trigger("click");
-			$("#sharelist option").css('color', '');
+	function public_checkbox (checkbox) {
+		if (checkbox.is(":checked") && ($("input[name=share]").val() == 'True')) {
 			$("#shareproject").trigger("click");
 		} 
 	}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/permissions.html	Mon Jan 09 12:44:15 2012 +0100
@@ -44,6 +44,7 @@
 		$("#shareproject").click(function () {
 			if (state == 1) {
 				$("#sharecontainer").show();
+				$("#public input").attr('checked', false);
 				$("input[id=id_share]").val('True');
 				var new_img = '<img class="shareicon" src=' + do_not_share_img + '>';
 				$(this).html(new_img + do_not_share);
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Mon Jan 09 12:44:15 2012 +0100
@@ -60,7 +60,7 @@
     group_list = sorted(group_list.all(), key=lambda group: group.name.lower())    
     group_list = add_change_attr(request.user, group_list)
 
-    can_add_group = True if request.user.user_permissions.filter(codename='add_group') else False
+    can_add_group = request.user.has_perm('auth.add_group')
     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
     # render list
     return render_to_response("ldt/ldt_utils/groups.html",
--- a/src/ldt/ldt/user/forms.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/user/forms.py	Mon Jan 09 12:44:15 2012 +0100
@@ -140,14 +140,14 @@
             return None
         
         class_name = self.model.__class__.__name__
-        if class_name == 'User':
-            instance_name = self.model.username
+        if class_name == 'User' or class_name == 'Group':
+            instance_name = self.model.id
             img_container = self.model.get_profile()
-        elif class_name == 'Group':
-            instance_name = self.model.name
-            img_container = self.model.profile
-        elif class_name == 'Content' or class_name == 'Project':
-            instance_name = self.model.title
+        elif class_name == 'Content':
+            instance_name = self.model.iri_id
+            img_container = self.model
+        elif class_name == 'Project':
+            instance_name = self.model.ldt_id
             img_container = self.model
             
         # We change the file name and keep the extension.
--- a/src/ldt/ldt/user/migrations/0006_auto__add_field_userprofile_image.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/user/migrations/0006_auto__add_field_userprofile_image.py	Mon Jan 09 12:44:15 2012 +0100
@@ -1,3 +1,4 @@
+#@PydevCodeAnalysisIgnore
 # encoding: utf-8
 import datetime
 from south.db import db
--- a/src/ldt/ldt/user/migrations/0007_auto__add_groupprofile.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/user/migrations/0007_auto__add_groupprofile.py	Mon Jan 09 12:44:15 2012 +0100
@@ -1,3 +1,4 @@
+#@PydevCodeAnalysisIgnore
 # encoding: utf-8
 import datetime
 from south.db import db
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/user/migrations/0008_auto__chg_field_groupprofile_image__chg_field_groupprofile_group__chg_.py	Mon Jan 09 12:44:15 2012 +0100
@@ -0,0 +1,85 @@
+#@PydevCodeAnalysisIgnore
+# encoding: 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 'GroupProfile.image'
+        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+        # Changing field 'UserProfile.image'
+        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=200))
+
+
+    def backwards(self, orm):
+        
+        # Changing field 'GroupProfile.image'
+        db.alter_column('user_groupprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+        # Changing field 'UserProfile.image'
+        db.alter_column('user_userprofile', 'image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100))
+
+
+    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'})
+        },
+        'user.groupprofile': {
+            'Meta': {'object_name': 'GroupProfile'},
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.Group']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/groups/group_default_icon.png'", 'max_length': '200'})
+        },
+        'user.ldt': {
+            'Meta': {'object_name': 'Ldt', '_ormbases': ['auth.User']},
+            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'})
+        },
+        'user.userprofile': {
+            'Meta': {'object_name': 'UserProfile'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('sorl.thumbnail.fields.ImageField', [], {'default': "'thumbnails/users/user_default_icon.png'", 'max_length': '200'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'fr'", 'max_length': '2'}),
+            'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
+        }
+    }
+
+    complete_apps = ['user']
--- a/src/ldt/ldt/user/models.py	Mon Jan 09 10:40:14 2012 +0100
+++ b/src/ldt/ldt/user/models.py	Mon Jan 09 12:44:15 2012 +0100
@@ -34,9 +34,8 @@
     
 class UserProfile (models.Model): 
     user = models.OneToOneField(User)
-    language = models.CharField(max_length=2, default=settings.LANGUAGE_CODE[:2])
-    
-    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/users/", default=settings.DEFAULT_USER_ICON)
+    language = models.CharField(max_length=2, default=settings.LANGUAGE_CODE[:2])    
+    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/users/", default=settings.DEFAULT_USER_ICON, max_length=200)
 
     @staticmethod
     def create_user_profile(sender, instance, created, **kwargs):
@@ -46,7 +45,7 @@
 class GroupProfile(models.Model):
     group = models.OneToOneField(Group, primary_key=False, related_name='profile')
     description = models.TextField()
-    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/groups/", default=settings.DEFAULT_GROUP_ICON)
+    image = ImageField(upload_to=settings.MEDIA_ROOT+"thumbnails/groups/", default=settings.DEFAULT_GROUP_ICON, max_length=200)
     
     @staticmethod
     def create_group_profile(sender, instance, created, **kwargs):
@@ -54,6 +53,13 @@
             profile = GroupProfile()
             profile.group_id = instance.id
             profile.save()
+            
+            
+# To keep consistency with User.get_profile() method
+def get_profile(self):
+    return self.profile
+
+Group.add_to_class("get_profile", get_profile)
 
 post_save.connect(GroupProfile.create_group_profile, sender=Group)
 post_save.connect(UserProfile.create_user_profile, sender=User)