django-hidefield


Namedjango-hidefield JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/jerch/django-hidefield
Summaryhide fields in django admin
upload_time2023-11-07 11:51:23
maintainer
docs_urlNone
authorJoerg Breitbart
requires_python
license
keywords django widget admin field hide
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ### django-hidefield ###

Provides a field base class to hide fields in django admin.
The class turns a field label in an admin edit form into a
show/hide toggle link.

Tested with Django 4.2.

#### Installation ####

- `pip install django-hidefield`
- place `'hidefield'` in `INSTALLED_APPS`

#### Usage ####

Build a custom field class for any model field type you want to hide.
The field has an additional argument `hide` with the following meaning:

- `'closed'`    : the field is hidden at start
- `'data'`      : the field is hidden at start, if the field contains data (default)
- `'no-data'`   : the field is hidden at start, if the field contains no data
- `'opened'`    : (or any other value) the field is shown at start

#### Example ####

```python
from django.db import models
from hidefield.fields import HideField


class HideCharField(HideField, models.CharField):
    pass


class MyModel(models.Model):
    name = HideCharField(max_length=32, hide='data')
```

See `exampleapp` for more examples.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jerch/django-hidefield",
    "name": "django-hidefield",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,widget,admin,field,hide",
    "author": "Joerg Breitbart",
    "author_email": "j.breitbart@netzkolchose.de",
    "download_url": "https://files.pythonhosted.org/packages/20/b0/81325004f257952bd07cf32119255c0a6d68a9806513a5f26931a87093dd/django-hidefield-0.2.0.tar.gz",
    "platform": null,
    "description": "### django-hidefield ###\n\nProvides a field base class to hide fields in django admin.\nThe class turns a field label in an admin edit form into a\nshow/hide toggle link.\n\nTested with Django 4.2.\n\n#### Installation ####\n\n- `pip install django-hidefield`\n- place `'hidefield'` in `INSTALLED_APPS`\n\n#### Usage ####\n\nBuild a custom field class for any model field type you want to hide.\nThe field has an additional argument `hide` with the following meaning:\n\n- `'closed'`    : the field is hidden at start\n- `'data'`      : the field is hidden at start, if the field contains data (default)\n- `'no-data'`   : the field is hidden at start, if the field contains no data\n- `'opened'`    : (or any other value) the field is shown at start\n\n#### Example ####\n\n```python\nfrom django.db import models\nfrom hidefield.fields import HideField\n\n\nclass HideCharField(HideField, models.CharField):\n    pass\n\n\nclass MyModel(models.Model):\n    name = HideCharField(max_length=32, hide='data')\n```\n\nSee `exampleapp` for more examples.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "hide fields in django admin",
    "version": "0.2.0",
    "project_urls": {
        "Download": "https://github.com/jerch/django-hidefield/archive/0.2.0.tar.gz",
        "Homepage": "https://github.com/jerch/django-hidefield"
    },
    "split_keywords": [
        "django",
        "widget",
        "admin",
        "field",
        "hide"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "20b081325004f257952bd07cf32119255c0a6d68a9806513a5f26931a87093dd",
                "md5": "d9c4ac45788ce82525e53dd7fb2d7709",
                "sha256": "a7c3226ea6ff5e3abb3325f9ba667cf11cf92919e2d8aeb72728904d6f4b7c9e"
            },
            "downloads": -1,
            "filename": "django-hidefield-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d9c4ac45788ce82525e53dd7fb2d7709",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4185,
            "upload_time": "2023-11-07T11:51:23",
            "upload_time_iso_8601": "2023-11-07T11:51:23.958156Z",
            "url": "https://files.pythonhosted.org/packages/20/b0/81325004f257952bd07cf32119255c0a6d68a9806513a5f26931a87093dd/django-hidefield-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-07 11:51:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jerch",
    "github_project": "django-hidefield",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-hidefield"
}
        
Elapsed time: 2.15315s