diff --git a/dpaste/migrations/0003_auto__del_field_snippet_content_highlighted.py b/dpaste/migrations/0003_auto__del_field_snippet_content_highlighted.py new file mode 100644 index 0000000..2cc1695 --- /dev/null +++ b/dpaste/migrations/0003_auto__del_field_snippet_content_highlighted.py @@ -0,0 +1,39 @@ +# -*- 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 field 'Snippet.content_highlighted' + db.delete_column(u'dpaste_snippet', 'content_highlighted') + + + def backwards(self, orm): + # Adding field 'Snippet.content_highlighted' + db.add_column(u'dpaste_snippet', 'content_highlighted', + self.gf('django.db.models.fields.TextField')(default='', blank=True), + keep_default=False) + + + models = { + u'dpaste.snippet': { + 'Meta': {'ordering': "('-published',)", 'object_name': 'Snippet'}, + 'content': ('django.db.models.fields.TextField', [], {}), + 'expires': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'lexer': ('django.db.models.fields.CharField', [], {'default': "'Python'", 'max_length': '30'}), + 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': u"orm['dpaste.Snippet']"}), + 'published': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'secret_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + } + } + + complete_apps = ['dpaste'] \ No newline at end of file diff --git a/dpaste/models.py b/dpaste/models.py index a055101..1b670d1 100644 --- a/dpaste/models.py +++ b/dpaste/models.py @@ -13,10 +13,9 @@ def generate_secret_id(length=5): class Snippet(models.Model): secret_id = models.CharField(_(u'Secret ID'), max_length=255, blank=True) content = models.TextField(_(u'Content'), ) - content_highlighted = models.TextField(_(u'Highlighted Content'), blank=True) lexer = models.CharField(_(u'Lexer'), max_length=30, default=LEXER_DEFAULT) published = models.DateTimeField(_(u'Published'), blank=True) - expires = models.DateTimeField(_(u'Expires'), blank=True, help_text='asdf') + expires = models.DateTimeField(_(u'Expires'), blank=True) parent = models.ForeignKey('self', null=True, blank=True, related_name='children') class Meta: @@ -27,7 +26,7 @@ class Snippet(models.Model): return len(self.content.splitlines()) def content_splitted(self): - return self.content_highlighted.splitlines() + return self.content.splitlines() @property def is_single(self): @@ -37,13 +36,12 @@ class Snippet(models.Model): if not self.pk: self.published = datetime.datetime.now() self.secret_id = generate_secret_id() - self.content_highlighted = self.content super(Snippet, self).save(*args, **kwargs) def get_absolute_url(self): return reverse('snippet_details', kwargs={'snippet_id': self.secret_id}) def __unicode__(self): - return '%s' % self.secret_id + return self.secret_id mptt.register(Snippet, order_insertion_by=['content']) \ No newline at end of file