use PEP8 convention on system fields for Records
authorymh <ymh.work@gmail.com>
Fri, 20 Sep 2013 10:55:05 +0200
changeset 108 c08f9b46a6c5
parent 107 48440ff95906
child 109 9328fa268f45
use PEP8 convention on system fields for Records
src/p4l/api/views.py
src/p4l/management/commands/import_record.py
src/p4l/migrations/0001_initial.py
src/p4l/models/data.py
--- a/src/p4l/api/views.py	Fri Sep 20 10:34:49 2013 +0200
+++ b/src/p4l/api/views.py	Fri Sep 20 10:55:05 2013 +0200
@@ -15,7 +15,7 @@
     def pre_save(self, obj):
         viewsets.ModelViewSet.pre_save(self, obj)
         if self.request and hasattr(self.request, 'user') and self.request.user:
-            obj.modifiedBy =  self.request.user
+            obj.modified_by =  self.request.user
 
     queryset = Record.objects.all()
     serializer_class = RecordSerializer
--- a/src/p4l/management/commands/import_record.py	Fri Sep 20 10:34:49 2013 +0200
+++ b/src/p4l/management/commands/import_record.py	Fri Sep 20 10:55:05 2013 +0200
@@ -112,8 +112,6 @@
     #             break
 
 
-
-
     def handle(self, *args, **options):
 
         self.batch_size = options.get('batch_size', 50)
--- a/src/p4l/migrations/0001_initial.py	Fri Sep 20 10:34:49 2013 +0200
+++ b/src/p4l/migrations/0001_initial.py	Fri Sep 20 10:55:05 2013 +0200
@@ -1,8 +1,9 @@
 # -*- coding: utf-8 -*-
 import datetime
+
+from django.db import models
 from south.db import db
 from south.v2 import SchemaMigration
-from django.db import models
 
 
 class Migration(SchemaMigration):
@@ -265,9 +266,9 @@
             ('isDocumentPart', self.gf('django.db.models.fields.BooleanField')(default=False)),
             ('hidden', self.gf('django.db.models.fields.BooleanField')(default=False)),
             ('restricted', self.gf('django.db.models.fields.BooleanField')(default=False)),
-            ('creationDate', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
-            ('modificationDate', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
-            ('modifiedBy', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['p4l.User'], null=True, blank=True)),
+            ('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+            ('modification_date', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
+            ('modified_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['p4l.User'], null=True, blank=True)),
         ))
         db.send_create_signal('p4l', ['Record'])
 
@@ -573,15 +574,15 @@
             'corporateAuthorLabel': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}),
             'corporateAuthors': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'recordsCorporateAuthor'", 'symmetrical': 'False', 'to': "orm['p4l.CorporateAuthor']"}),
             'countries': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['p4l.Country']", 'symmetrical': 'False'}),
-            'creationDate': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
             'editionStatement': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
             'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
             'identifier': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
             'isDocumentPart': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
             'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['p4l.Language']", 'null': 'True', 'blank': 'True'}),
-            'modificationDate': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
-            'modifiedBy': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['p4l.User']", 'null': 'True', 'blank': 'True'}),
+            'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['p4l.User']", 'null': 'True', 'blank': 'True'}),
             'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
             'otherLanguages': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'otherLanguage_record'", 'symmetrical': 'False', 'to': "orm['p4l.Language']"}),
             'projectNames': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['p4l.ProjectName']", 'symmetrical': 'False'}),
--- a/src/p4l/models/data.py	Fri Sep 20 10:34:49 2013 +0200
+++ b/src/p4l/models/data.py	Fri Sep 20 10:55:05 2013 +0200
@@ -167,9 +167,9 @@
     restricted = models.BooleanField(default=False) #iiep:restricted
     
     #Record import date and modification date
-    creationDate = models.DateTimeField( auto_now_add=True, serialize=False)
-    modificationDate = models.DateTimeField(auto_now=True, serialize=False)
-    modifiedBy = models.ForeignKey(User, blank=True, null=True)
+    creation_date = models.DateTimeField( auto_now_add=True, serialize=False)
+    modification_date = models.DateTimeField(auto_now=True, serialize=False)
+    modified_by = models.ForeignKey(User, blank=True, null=True)
     
     def get_imprints_years(self):
         return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))