Parcourir la source

Disallow year, month and day lookups

Thomas Adamcik il y a 15 ans
Parent
commit
5048d4e5c0
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      manager.py

+ 3 - 0
manager.py

@@ -91,6 +91,9 @@ class _NetAddressField(models.Field):
         if value is None:
             return value
 
+        if lookup_type in ['year', 'month', 'day']:
+            raise ValueError('Invalid lookup type "%s"' % lookup_type)
+
         if lookup_type in NET_MAPPING:
             return self.get_db_prep_lookup(
                 NET_MAPPING[lookup_type], value)