Commit f63a4432 by e0d

Merge pull request #2086 from edx/bugfix/e0d/resize-notes-uri

Bugfix/e0d/resize notes uri
parents 3671c7a7 0e375644
...@@ -13,7 +13,7 @@ class Migration(SchemaMigration): ...@@ -13,7 +13,7 @@ class Migration(SchemaMigration):
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), ('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
('uri', self.gf('django.db.models.fields.CharField')(max_length=1024, db_index=True)), ('uri', self.gf('django.db.models.fields.CharField')(max_length=512, db_index=True)),
('text', self.gf('django.db.models.fields.TextField')(default='')), ('text', self.gf('django.db.models.fields.TextField')(default='')),
('quote', self.gf('django.db.models.fields.TextField')(default='')), ('quote', self.gf('django.db.models.fields.TextField')(default='')),
('range_start', self.gf('django.db.models.fields.CharField')(max_length=2048)), ('range_start', self.gf('django.db.models.fields.CharField')(max_length=2048)),
...@@ -82,7 +82,7 @@ class Migration(SchemaMigration): ...@@ -82,7 +82,7 @@ class Migration(SchemaMigration):
'tags': ('django.db.models.fields.TextField', [], {'default': "''"}), 'tags': ('django.db.models.fields.TextField', [], {'default': "''"}),
'text': ('django.db.models.fields.TextField', [], {'default': "''"}), 'text': ('django.db.models.fields.TextField', [], {'default': "''"}),
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
'uri': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), 'uri': ('django.db.models.fields.CharField', [], {'max_length': '512', 'db_index': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
} }
} }
......
...@@ -9,7 +9,7 @@ import json ...@@ -9,7 +9,7 @@ import json
class Note(models.Model): class Note(models.Model):
user = models.ForeignKey(User, db_index=True) user = models.ForeignKey(User, db_index=True)
course_id = models.CharField(max_length=255, db_index=True) course_id = models.CharField(max_length=255, db_index=True)
uri = models.CharField(max_length=1024, db_index=True) uri = models.CharField(max_length=512, db_index=True)
text = models.TextField(default="") text = models.TextField(default="")
quote = models.TextField(default="") quote = models.TextField(default="")
range_start = models.CharField(max_length=2048) # xpath string range_start = models.CharField(max_length=2048) # xpath string
...@@ -21,9 +21,9 @@ class Note(models.Model): ...@@ -21,9 +21,9 @@ class Note(models.Model):
updated = models.DateTimeField(auto_now=True, db_index=True) updated = models.DateTimeField(auto_now=True, db_index=True)
def clean(self, json_body): def clean(self, json_body):
''' """
Cleans the note object or raises a ValidationError. Cleans the note object or raises a ValidationError.
''' """
if json_body is None: if json_body is None:
raise ValidationError('Note must have a body.') raise ValidationError('Note must have a body.')
...@@ -53,16 +53,16 @@ class Note(models.Model): ...@@ -53,16 +53,16 @@ class Note(models.Model):
self.tags = ",".join(tags) self.tags = ",".join(tags)
def get_absolute_url(self): def get_absolute_url(self):
''' """
Returns the aboslute url for the note object. Returns the absolute url for the note object.
''' """
kwargs = {'course_id': self.course_id, 'note_id': str(self.pk)} kwargs = {'course_id': self.course_id, 'note_id': str(self.pk)}
return reverse('notes_api_note', kwargs=kwargs) return reverse('notes_api_note', kwargs=kwargs)
def as_dict(self): def as_dict(self):
''' """
Returns the note object as a dictionary. Returns the note object as a dictionary.
''' """
return { return {
'id': self.pk, 'id': self.pk,
'user_id': self.user.pk, 'user_id': self.user.pk,
......
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 to comment