Skip to content

Commit

Permalink
Added category to document
Browse files Browse the repository at this point in the history
  • Loading branch information
plaetzchen committed Jul 21, 2012
1 parent e888f83 commit 4a2da9e
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
76 changes: 76 additions & 0 deletions publicdocs/documents/migrations/0004_auto.py
@@ -0,0 +1,76 @@
# -*- 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 categories on 'Document'
db.create_table('documents_document_categories', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('document', models.ForeignKey(orm['documents.document'], null=False)),
('category', models.ForeignKey(orm['documents.category'], null=False))
))
db.create_unique('documents_document_categories', ['document_id', 'category_id'])


def backwards(self, orm):
# Removing M2M table for field categories on 'Document'
db.delete_table('documents_document_categories')


models = {
'documents.author': {
'Meta': {'object_name': 'Author'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'institution': ('django.db.models.fields.CharField', [], {'max_length': '254', 'null': 'True', 'blank': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '254'})
},
'documents.category': {
'Meta': {'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'})
},
'documents.document': {
'Meta': {'object_name': 'Document'},
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Author']", 'null': 'True'}),
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['documents.Category']", 'null': 'True', 'symmetrical': 'False'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'pages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['documents.Page']", 'null': 'True', 'symmetrical': 'False'}),
'relations': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['documents.Relation']", 'null': 'True', 'symmetrical': 'False'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'}),
'version': ('django.db.models.fields.IntegerField', [], {'default': '1'})
},
'documents.page': {
'Meta': {'object_name': 'Page'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'number': ('django.db.models.fields.IntegerField', [], {}),
'paragraphs': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['documents.Paragraph']", 'symmetrical': 'False'})
},
'documents.paragraph': {
'Meta': {'object_name': 'Paragraph'},
'content': ('django.db.models.fields.TextField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'})
},
'documents.relation': {
'Meta': {'object_name': 'Relation'},
'comment': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'type': ('django.db.models.fields.IntegerField', [], {'max_length': '1'})
}
}

complete_apps = ['documents']
2 changes: 1 addition & 1 deletion publicdocs/documents/models.py
Expand Up @@ -12,7 +12,7 @@ class Document(models.Model):
pages = models.ManyToManyField('documents.Page',null=True)
version = models.IntegerField(default=1)
relations = models.ManyToManyField('documents.Relation',null=True)
relations = models.ManyToManyField('documents.Category',null=True)
categories = models.ManyToManyField('documents.Category',null=True)
created = models.DateTimeField(auto_now_add=True,null=True)
modified = models.DateTimeField(auto_now=True, null=True)

Expand Down
Binary file modified publicdocs/publicdocs.sqlite
Binary file not shown.

0 comments on commit 4a2da9e

Please sign in to comment.