From 9b263c61f805947a06473fd5ca170e8b970aae32 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 20 Jul 2010 21:04:51 +0000 Subject: [PATCH] [soc2010/query-refactor] Added a forgotten file from r13441. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13442 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/fields/structures.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 django/db/models/fields/structures.py diff --git a/django/db/models/fields/structures.py b/django/db/models/fields/structures.py new file mode 100644 index 0000000000..2d3822e932 --- /dev/null +++ b/django/db/models/fields/structures.py @@ -0,0 +1,21 @@ +from django.db.models.fields import Field + + +class ListField(Field): + def __init__(self, field_type): + self.field_type = field_type + super(ListField, self).__init__() + + def get_prep_lookup(self, lookup_type, value): + return self.field_type.get_prep_lookup(lookup_type, value) + + def get_db_prep_save(self, value, connection): + return [ + self.field_type.get_db_prep_save(o, connection=connection) + for o in value + ] + + def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False): + return self.field_type.get_db_prep_lookup( + lookup_type, value, connection=connection, prepared=prepared + )