Jannis Leidel avatar Jannis Leidel committed 054c2f5

Minor cleanups.

Comments (0)

Files changed (2)


 from django.db import models
 from django.conf import settings
-class AutoCreatedField (models.DateTimeField):
+class AutoCreatedField(models.DateTimeField):
     A DateTimeField that automatically populates itself at
     object creation.
     By default, sets editable=False, default=datetime.now.
-    def __init__ (self, *args, **kwargs):
+    def __init__(self, *args, **kwargs):
         kwargs.setdefault('editable', False)
         kwargs.setdefault('default', datetime.now)
         super(AutoCreatedField, self).__init__(*args, **kwargs)
-class AutoLastModifiedField (AutoCreatedField):
+class AutoLastModifiedField(AutoCreatedField):
     A DateTimeField that updates itself on each save() of the model.
     By default, sets editable=False and default=datetime.now.
-    def pre_save (self, model_instance, add):
+    def pre_save(self, model_instance, add):
         value = datetime.now()
         setattr(model_instance, self.attname, value)
-        return value    
+        return value
 SPLIT_MARKER = getattr(settings, 'SPLIT_MARKER', '<!-- split -->')


     real_type = models.ForeignKey(ContentType, editable=False, null=True)
     def save(self, *args, **kwargs):
         if not self.id:
             self.real_type = self._get_real_type()
         super(InheritanceCastModel, self).save(*args, **kwargs)
     def _get_real_type(self):
         return ContentType.objects.get_for_model(type(self))
     def cast(self):
         return self.real_type.get_object_for_this_type(pk=self.pk)
     class Meta:
         abstract = True
-class TimeStampedModel (models.Model):
+class TimeStampedModel(models.Model):
     An abstract base class model that provides self-updating
     ``created`` and ``modified`` fields.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.