Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/migration-prep-commoninfo
into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/migration-prep-commoninfo/+merge/103057
This sets the stage for the first of the model migrations. There's not much to
do for CommonInfo, but it has to be migrated fairly early on to avoid circular
imports: several other model classes need it for their definition, but they
can't import it from __init__.py because that also needs to import those other
model classes.
Jeroen
--
https://code.launchpad.net/~jtv/maas/migration-prep-commoninfo/+merge/103057
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~jtv/maas/migration-prep-commoninfo into lp:maas.
=== modified file 'src/maasserver/models/__init__.py'
--- src/maasserver/models/__init__.py 2012-04-23 04:20:42 +0000
+++ src/maasserver/models/__init__.py 2012-04-23 08:35:23 +0000
@@ -57,6 +57,7 @@
from django.db.models.signals import post_save
from django.shortcuts import get_object_or_404
from django.utils.safestring import mark_safe
+from maasserver import DefaultMeta
from maasserver.enum import (
ARCHITECTURE,
ARCHITECTURE_CHOICES,
@@ -99,6 +100,7 @@
logger = getLogger('maasserver')
+# Due for model migration on 2012-04-30.
class CommonInfo(models.Model):
"""A base model which:
- calls full_clean before saving the model (by default).
@@ -108,12 +110,13 @@
:ivar updated: The last modification date.
"""
+
+ class Meta(DefaultMeta):
+ abstract = True
+
created = models.DateField(editable=False)
updated = models.DateTimeField(editable=False)
- class Meta:
- abstract = True
-
def save(self, skip_check=False, *args, **kwargs):
if not self.id:
self.created = datetime.date.today()
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp