Skip to content
This repository

Added support for South to introspect TimeZoneField #13

Open
wants to merge 1 commit into from

10 participants

Siddharth Mitra roberts81 Adam Charnock luke crouch Vlada Macek Karolina Hidalgo Brian Rosner Olivier Girardot Chris Chambers Igor Davydenko
Siddharth Mitra

No description provided.

roberts81

+1

Vlada Macek

+1

Brian Rosner
Owner

Is this still relevant? If so, can the coding style please be cleaned up? See existing coding style.

luke crouch

Still relevant for sure.

Olivier Girardot

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

May 11, 2011
Siddharth Mitra Added support for South to introspect TimeZoneField cd39c66
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. 15  timezones/fields.py
15  timezones/fields.py
@@ -155,3 +155,18 @@ def set_dtz_field(instance, dt):
155 155
 ## RED_FLAG: need to add a check at manage.py validation time that
156 156
 ##           time_zone value is a valid query keyword (if it is one)
157 157
 signals.class_prepared.connect(prep_localized_datetime)
  158
+
  159
+
  160
+# allow South to handle TimeZoneField smoothly
  161
+try:
  162
+    from south.modelsinspector import add_introspection_rules
  163
+    add_introspection_rules(rules=[(
  164
+                                    (TimeZoneField, ),  # Class(es) these apply to
  165
+                                    [],                 # Positional arguments (not used)
  166
+                                    {                   # Keyword argument
  167
+                                        "max_length": ["max_length", { "default": MAX_TIMEZONE_LENGTH }],
  168
+                                    }
  169
+                                )],
  170
+                                patterns=['timezones\.fields\.'])
  171
+except ImportError:
  172
+    pass
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.