Skip to main content

A new model and form field flexible for schema changes, stored as JSON in database.

Project description

django-configfield

A new model and form field flexible for schema changes. Internally is stored as JSON field in database.

Installation

In your settings.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',

    #.....................#

    'configfield',
)

In your models.py

class MyModel(models.Model):

    .....

    config = ConfigField(verbose_name=_('Config'), null=True, blank=True)

In your forms.py

class MyForm(forms.ModelForm):

    class Meta:
        model = MyModel

    def __init__(self, *args, **kwargs):
        super(MyForm, self).__init__(*args, **kwargs)
        if self.instance.pk:
            config_dict = self.instance.config
        else:
            config_dict = MY_DEFAULT_CONFIG_DICT
        self.fields['config'].set_config_dict(config_dict)

Development

You can get the last bleeding edge version of django-configfield by doing a clone of its hg repository:

hg clone https://bitbucket.org/msaelices/django-configfield

0.2.1

  • Fix a error, when a param of the dict was None

0.2.0

  • Add the set_config_dict function

  • Remove the smart_if dependence

  • Remove the JSONField class and use the JSONField of the django-jsonfield egg

  • Write a readme with an install

  • Add the django-jsonfield in the requeriements

0.1.0-beta

  • Improved type checking. Needed when the config field is placed in a subclass.

  • Fix name of base template.

0.1.0-alpha

  • Initial version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-configfield-0.2.1.tar.gz (13.6 kB view details)

Uploaded Source

File details

Details for the file django-configfield-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-configfield-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5178969c5bec8bed08130bdb1109d830e08b12cb93f0c6a5a2ba043ff94c3da2
MD5 9ff9fd42c2e985ba1087fc6d9748f59e
BLAKE2b-256 422c9bb507746e114df1bb21ead249f92c9847e375787abe2f605ae530871a0c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page