Matthew Schinckel avatar Matthew Schinckel committed 4e0eb90

Resolves #1. Restore functionality in django < 1.2

Comments (0)

Files changed (1)


 from django.db import models
 import datetime
-from collections import defaultdict
-import re
-from helpers import nice_repr, parse
+from helpers import parse
 from forms import TimedeltaFormField
 SECS_PER_DAY = 60*60*24
 class TimedeltaField(models.Field):
-    Store a datetime.timedelta as an integer.
-    We don't subclass models.IntegerField, as that would then use the
-    AdminIntegerWidget or whatever in the admin, and we want to use
-    our custom widget.
+    Store a datetime.timedelta as an INTERVAL in postgres, or a 
+    CHAR(20) in other database backends.
     __metaclass__ = models.SubfieldBase
     _south_introspects = True
             return value
         return str(value).replace(',', '')
-    def get_db_prep_value(self, value, connection, prepared=None):
+    def get_db_prep_value(self, value, connection=None, prepared=None):
         return self.get_prep_value(value)
     def formfield(self, *args, **kwargs):
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
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.