[Answer]-Django South add_inrospection_rules for django-private-files field with callable as value for field attribute

1đź‘Ť

âś…

According to Andrew Godwin: “South’s introspection system isn’t designed for a second level of call-ability.”(reference) This means that the only way around this problem at this time is to omit the rule for the condition argument and just tell south that the field is OK. So:

# myapp/fields.py
from private_files import PrivateFileField
"""
South introspection rules
"""

from south.modelsinspector import add_introspection_rules
rules = [
    (
        (PrivateFileField,),
        [],
        {
            "attachment" : ["attachment", {"default": True}],
        },
    )]

add_introspection_rules(
    rules,
    ["^private_files\.models\.fields\.PrivateFileField"])
👤Marconius

Leave a comment