from django.db import models
from payment.config import credit_choices, labelled_gateway_choices

class CreditChoiceCharField(models.CharField):

    def __init__(self, choices="__DYNAMIC__", *args, **kwargs):
        if choices == "__DYNAMIC__":
            kwargs['choices'] = credit_choices()

        super(CreditChoiceCharField, self).__init__(*args, **kwargs)

class PaymentChoiceCharField(models.CharField):
    
    def __init__(self, choices="__DYNAMIC__", *args, **kwargs):
        if choices == "__DYNAMIC__":
            kwargs['choices'] = labelled_gateway_choices()
                    
        super(PaymentChoiceCharField, self).__init__(*args, **kwargs)

@@ -644,28 +644,652 @@
 ).__init__(*args, **kwargs)%0A
+%0Atry:%0A    # South introspection rules for our custom field.%0A    from south.modelsinspector import add_introspection_rules, matching_details%0A%0A    # get the kwargs for a Field instance%0A    # we're using Field, as CharField doesn't change __init__()%0A    _args, kwargs = matching_details(models.Field())%0A%0A    add_introspection_rules(%5B(%0A        (CreditChoiceCharField, ),%0A        %5B%5D,%0A        kwargs,%0A    )%5D, %5B'payment%5C.fields%5C.CreditChoiceCharField'%5D)%0A    add_introspection_rules(%5B(%0A        (PaymentChoiceCharField, ),%0A        %5B%5D,%0A        kwargs,%0A    )%5D, %5B'payment%5C.fields%5C.PaymentChoiceCharField'%5D)%0Aexcept ImportError:%0A    pass%0A

add introspection rules for South for CreditChoiceCharField and PaymentChoiceCharField