[yocto] [layerindex-web][PATCH v2 13/15] Preemptive auto_now fix for Django 1.8

Paul Eggleton paul.eggleton at linux.intel.com
Wed Jun 8 06:20:06 PDT 2016


Django 1.8 does not allow DateFields that have both auto_now and default
set - since they are mutually exclusive; if you have auto_now you don't
need a default.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 layerindex/models.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/layerindex/models.py b/layerindex/models.py
index 3a5796d..0ed90a4 100644
--- a/layerindex/models.py
+++ b/layerindex/models.py
@@ -38,7 +38,7 @@ class Branch(models.Model):
     updates_enabled = models.BooleanField('Enable updates', default=True, help_text='Enable automatically updating layer metadata for this branch via the update script')
     update_environment = models.ForeignKey(PythonEnvironment, blank=True, null=True, on_delete=models.SET_NULL)
 
-    updated = models.DateTimeField(auto_now = True, default = datetime.now)
+    updated = models.DateTimeField(auto_now=True)
 
     class Meta:
         verbose_name_plural = "Branches"
@@ -73,7 +73,7 @@ class LayerItem(models.Model):
     index_preference = models.IntegerField('Preference', default=0, help_text='Number used to find preferred recipes in recipe search results (higher number is greater preference)')
     classic = models.BooleanField('Classic', default=False, help_text='Is this OE-Classic?')
 
-    updated = models.DateTimeField(auto_now = True)
+    updated = models.DateTimeField(auto_now=True)
 
     class Meta:
         verbose_name = "Layer"
@@ -136,7 +136,7 @@ class LayerBranch(models.Model):
     vcs_last_commit = models.DateTimeField('Last commit date', blank=True, null=True)
     actual_branch = models.CharField('Actual Branch', max_length=80, blank=True, help_text='Name of the actual branch in the repository matching the core branch')
 
-    updated = models.DateTimeField(auto_now = True)
+    updated = models.DateTimeField(auto_now=True)
 
     class Meta:
         verbose_name_plural = "Layer branches"
@@ -261,7 +261,7 @@ class Recipe(models.Model):
     provides = models.CharField(max_length=2048, blank=True)
     bbclassextend = models.CharField(max_length=100, blank=True)
     inherits = models.CharField(max_length=255, blank=True)
-    updated = models.DateTimeField(auto_now = True)
+    updated = models.DateTimeField(auto_now=True)
     blacklisted = models.CharField(max_length=255, blank=True)
 
     def vcs_web_url(self):
@@ -352,7 +352,7 @@ class Machine(models.Model):
     name = models.CharField(max_length=255)
     description = models.CharField(max_length=255)
 
-    updated = models.DateTimeField(auto_now = True)
+    updated = models.DateTimeField(auto_now=True)
 
     def vcs_web_url(self):
         url = self.layerbranch.file_url(os.path.join('conf/machine/%s.conf' % self.name))
-- 
2.5.5




More information about the yocto mailing list