web/lib/django/db/models/fields/proxy.py
author ymh <ymh.work@gmail.com>
Tue, 15 Mar 2011 10:34:41 +0100
changeset 65 3d18d15135f1
parent 38 77b6da96e6f1
permissions -rw-r--r--
put video url in segment object
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
"""
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
Field-like classes that aren't really fields. It's easier to use objects that
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
have the same attributes as fields sometimes (avoids a lot of special casing).
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
"""
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
from django.db.models import fields
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
class OrderWrt(fields.IntegerField):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
    """
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    A proxy for the _order database field that is used when
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    Meta.order_with_respect_to is specified.
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    """
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    def __init__(self, *args, **kwargs):
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
        kwargs['name'] = '_order'
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
        kwargs['editable'] = False
77b6da96e6f1 update django
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
        super(OrderWrt, self).__init__(*args, **kwargs)