Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
364bcdd
commit 4848c19
Showing
78 changed files
with
18,769 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
from django.forms import ModelForm | |||
from django import forms | |||
|
|||
from documents.models import Comment, Relation | |||
|
|||
class CommentForm(ModelForm): | |||
''' Used for the comments ''' | |||
class Meta: | |||
model = Comment | |||
exclude = ["ip","moderated","document"] | |||
|
|||
class RelationForm(ModelForm): | |||
''' Used for adding relations ''' | |||
class Meta: | |||
model = Relation | |||
fields = ["type", "relatedDocument", "comment"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,98 @@ | |||
# -*- 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 'Comment' | |||
db.create_table('documents_comment', ( | |||
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | |||
('name', self.gf('django.db.models.fields.CharField')(max_length=254)), | |||
('ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15, null=True, blank=True)), | |||
('moderated', self.gf('django.db.models.fields.BooleanField')(default=False)), | |||
('comment', self.gf('django.db.models.fields.TextField')(max_length=1000)), | |||
('page', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Page'])), | |||
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), | |||
('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), | |||
)) | |||
db.send_create_signal('documents', ['Comment']) | |||
|
|||
|
|||
def backwards(self, orm): | |||
# Deleting model 'Comment' | |||
db.delete_table('documents_comment') | |||
|
|||
|
|||
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'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}) | |||
}, | |||
'documents.category': { | |||
'Meta': {'object_name': 'Category'}, | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}), | |||
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'}) | |||
}, | |||
'documents.comment': { | |||
'Meta': {'object_name': 'Comment'}, | |||
'comment': ('django.db.models.fields.TextField', [], {'max_length': '1000'}), | |||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), | |||
'moderated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), | |||
'name': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | |||
'page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Page']"}) | |||
}, | |||
'documents.document': { | |||
'Meta': {'object_name': 'Document'}, | |||
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Author']", 'null': 'True', 'blank': 'True'}), | |||
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['documents.Category']", 'null': 'True', 'blank': 'True'}), | |||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), | |||
'documentCreated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | |||
'documentModified': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'md5hash': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}), | |||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), | |||
'pages': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'document'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['documents.Page']"}), | |||
'relations': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['documents.Relation']", 'null': 'True', 'blank': 'True'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}), | |||
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | |||
'version': ('django.db.models.fields.IntegerField', [], {'default': '1'}) | |||
}, | |||
'documents.page': { | |||
'Meta': {'object_name': 'Page'}, | |||
'content': ('django.db.models.fields.TextField', [], {'null': 'True'}), | |||
'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', [], {}) | |||
}, | |||
'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'] |
105 changes: 105 additions & 0 deletions
105
...ocs/documents/migrations/0011_auto__add_field_comment_document__chg_field_comment_page.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,105 @@ | |||
# -*- 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 'Comment.document' | |||
db.add_column('documents_comment', 'document', | |||
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'], null=True), | |||
keep_default=False) | |||
|
|||
|
|||
# Renaming column for 'Comment.page' to match new field type. | |||
db.rename_column('documents_comment', 'page_id', 'page') | |||
# Changing field 'Comment.page' | |||
db.alter_column('documents_comment', 'page', self.gf('django.db.models.fields.IntegerField')(null=True)) | |||
# Removing index on 'Comment', fields ['page'] | |||
db.delete_index('documents_comment', ['page_id']) | |||
|
|||
|
|||
def backwards(self, orm): | |||
# Adding index on 'Comment', fields ['page'] | |||
db.create_index('documents_comment', ['page_id']) | |||
|
|||
# Deleting field 'Comment.document' | |||
db.delete_column('documents_comment', 'document_id') | |||
|
|||
|
|||
# User chose to not deal with backwards NULL issues for 'Comment.page' | |||
raise RuntimeError("Cannot reverse this migration. 'Comment.page' and its values cannot be restored.") | |||
|
|||
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'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}) | |||
}, | |||
'documents.category': { | |||
'Meta': {'object_name': 'Category'}, | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}), | |||
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'}) | |||
}, | |||
'documents.comment': { | |||
'Meta': {'object_name': 'Comment'}, | |||
'comment': ('django.db.models.fields.TextField', [], {'max_length': '1000'}), | |||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | |||
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']", 'null': 'True'}), | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}), | |||
'moderated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | |||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), | |||
'name': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | |||
'page': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) | |||
}, | |||
'documents.document': { | |||
'Meta': {'object_name': 'Document'}, | |||
'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Author']", 'null': 'True', 'blank': 'True'}), | |||
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['documents.Category']", 'null': 'True', 'blank': 'True'}), | |||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), | |||
'documentCreated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | |||
'documentModified': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | |||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | |||
'md5hash': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}), | |||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), | |||
'pages': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'document'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['documents.Page']"}), | |||
'relations': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['documents.Relation']", 'null': 'True', 'blank': 'True'}), | |||
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'populate_from': 'None', 'unique_with': '()'}), | |||
'title': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | |||
'version': ('django.db.models.fields.IntegerField', [], {'default': '1'}) | |||
}, | |||
'documents.page': { | |||
'Meta': {'object_name': 'Page'}, | |||
'content': ('django.db.models.fields.TextField', [], {'null': 'True'}), | |||
'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', [], {}) | |||
}, | |||
'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'] |
Oops, something went wrong.