remove "comment" from the model. Copy the 'comment' field of Jamespot in the 'description' field of the model instead
authorrougeronj
Fri, 22 May 2015 12:37:37 +0200
changeset 90 faf2cdb47813
parent 89 7faa53118457
child 91 f7a844a9079e
remove "comment" from the model. Copy the 'comment' field of Jamespot in the 'description' field of the model instead
server/ammico/models.py
server/ammico/serializers.py
server/ammico/views.py
--- a/server/ammico/models.py	Fri May 22 12:35:53 2015 +0200
+++ b/server/ammico/models.py	Fri May 22 12:37:37 2015 +0200
@@ -24,7 +24,6 @@
     idInventory = models.CharField(max_length=512, blank=True)
     title = models.CharField(max_length=512, blank=True)
     description = models.CharField(max_length=1024, blank=True)
-    comment = models.CharField(max_length=2048, blank=True)
     image = models.URLField(max_length=2048, blank=True)
     date = models.DateTimeField(default=datetime.datetime.now)
     favorite = models.BooleanField(default=False, db_index=True)
--- a/server/ammico/serializers.py	Fri May 22 12:35:53 2015 +0200
+++ b/server/ammico/serializers.py	Fri May 22 12:37:37 2015 +0200
@@ -35,7 +35,7 @@
 
     class Meta:
         model = Slide
-        fields = ('id', 'index', 'book', 'idStop', 'idInventory', 'title', 'description', 'comment', 'image', 'date', 'favorite', 'details')
+        fields = ('id', 'index', 'book', 'idStop', 'idInventory', 'title', 'description', 'image', 'date', 'favorite', 'details')
         
 
 def extractFromMIMO(slide):
--- a/server/ammico/views.py	Fri May 22 12:35:53 2015 +0200
+++ b/server/ammico/views.py	Fri May 22 12:37:37 2015 +0200
@@ -52,15 +52,15 @@
         if (step['stop'] != None and step['stop'] != ''):
             
             if 'comment' in step:
-                comment = step['comment']
+                description = step['comment']
             else:
-                comment = ""
+                description = ""
             
             Slide.objects.update_or_create(
                 book=book,
                 idStop=step['stop'],
                 defaults={
-                    'comment' : comment,
+                    'description' : description,
                     'date' : parse_datetime(str(datetime.strptime(step['DATE'] + " " + step['TIME'], "%d/%m/%Y %H:%M:%S")))
                 }
             )