sam-djtools


Namesam-djtools JSON
Version 1.2.42 PyPI version JSON
download
home_pagehttps://github.com/humblesami/sam-djtools.git
Summary1 sam_djtools.DbUtils, 2 sam_djtools.EmailUtils, 3. sam_djtools.GeneralUtils 4. Primary key based form navigation to explore next/prev records.
upload_time2024-11-10 20:46:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3
licenseNone
keywords djtools django-tools form-navigation email-in-thread
VCS
bugtrack_url
requirements build setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **Installation**

1. `pip install sam-djtools`
2. Add `sam_djtools` in installed apps in `settings.py` of django project
   

    INSTALLED_APPS = [
       'sam_djtools',
       # ...
    ]
(at the top)

**Description**

It adds Next and Prev buttons to the top of each edit form of django admin site
for all the models of all the apps in your project, without need to do anything
except installing the module with pip plus adding to the top of `INSTALLED_APPS` in `settings.py`

**Instructions to run the sample usage**

1. `git clone https://github.com/humblesami/sam-djtools.git`
2. `cd sample_usage`
3. `pip install -r requirements.txt`
4. `python manage.py resetdb`
   1. This step will delete db (if engine is sqlite or posgtgresql)
   2. will make makemigrations and migrate 
   3. will create db
   4. create a super user `admin@localhost` with password `123`
   5. Will create three records of `ModelWithUpdateLog`

5. `python manage.py runsever`

### Features

1. You can import and use `GeneralUtils, EmailUtils, DbUtils` having variety of methods 
which we commonly would need to write in django project
2. Form navigation => while changing/reading records in form, you n=can navigate to next/prev records
3. You can use python manage.py resetdb if during development you need, also you can set 
`FIXTURES_PATH = str(BASE_DIR) + '/fixtures.json'` to your existing data
so all can be reset using a single command
4. The sample app contains a model (as following) inherited from `SamModel` and 
the `SamModel` is set to maintain all the update logs automatically

```
from django.db import models
from sam_djtools.admin_models import SamModel

class ModelWithUpdateLog(SamModel):
    name = models.CharField(max_length=100)

    def __str__(self):
        return self.name
```
and an admin as
```
from django.contrib import admin
from sam_djtools.admin_models import SamAdmin
from .models import ModelWithUpdateLog

class ModelUpdateLogAdmin(SamAdmin):
    pass

admin.site.register(ModelWithUpdateLog, ModelUpdateLogAdmin)
```
This admin will show all record update logs in form because we have set

```ADMIN_UPDATE_LOGS = True```

in `settings.py`

Open following url in your browser and login with given username `admin@localhost` and password `123`
   http://localhost:8000/admin/sample_app/modelwithupdatelog/1/change/
to explore the `update logs` and `navigation` feature 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/humblesami/sam-djtools.git",
    "name": "sam-djtools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "Sami Akram <samiakram@live.com>",
    "keywords": "djtools, django-tools, form-navigation, email-in-thread",
    "author": null,
    "author_email": "Sami Akram <samiakram@live.com>",
    "download_url": "https://files.pythonhosted.org/packages/d6/44/6902cfe73483e52c393d76518a9fe3773c97b9dfeda5bb1036c3f290a4bf/sam_djtools-1.2.42.tar.gz",
    "platform": null,
    "description": "**Installation**\n\n1. `pip install sam-djtools`\n2. Add `sam_djtools` in installed apps in `settings.py` of django project\n   \n\n    INSTALLED_APPS = [\n       'sam_djtools',\n       # ...\n    ]\n(at the top)\n\n**Description**\n\nIt adds Next and Prev buttons to the top of each edit form of django admin site\nfor all the models of all the apps in your project, without need to do anything\nexcept installing the module with pip plus adding to the top of `INSTALLED_APPS` in `settings.py`\n\n**Instructions to run the sample usage**\n\n1. `git clone https://github.com/humblesami/sam-djtools.git`\n2. `cd sample_usage`\n3. `pip install -r requirements.txt`\n4. `python manage.py resetdb`\n   1. This step will delete db (if engine is sqlite or posgtgresql)\n   2. will make makemigrations and migrate \n   3. will create db\n   4. create a super user `admin@localhost` with password `123`\n   5. Will create three records of `ModelWithUpdateLog`\n\n5. `python manage.py runsever`\n\n### Features\n\n1. You can import and use `GeneralUtils, EmailUtils, DbUtils` having variety of methods \nwhich we commonly would need to write in django project\n2. Form navigation => while changing/reading records in form, you n=can navigate to next/prev records\n3. You can use python manage.py resetdb if during development you need, also you can set \n`FIXTURES_PATH = str(BASE_DIR) + '/fixtures.json'` to your existing data\nso all can be reset using a single command\n4. The sample app contains a model (as following) inherited from `SamModel` and \nthe `SamModel` is set to maintain all the update logs automatically\n\n```\nfrom django.db import models\nfrom sam_djtools.admin_models import SamModel\n\nclass ModelWithUpdateLog(SamModel):\n    name = models.CharField(max_length=100)\n\n    def __str__(self):\n        return self.name\n```\nand an admin as\n```\nfrom django.contrib import admin\nfrom sam_djtools.admin_models import SamAdmin\nfrom .models import ModelWithUpdateLog\n\nclass ModelUpdateLogAdmin(SamAdmin):\n    pass\n\nadmin.site.register(ModelWithUpdateLog, ModelUpdateLogAdmin)\n```\nThis admin will show all record update logs in form because we have set\n\n```ADMIN_UPDATE_LOGS = True```\n\nin `settings.py`\n\nOpen following url in your browser and login with given username `admin@localhost` and password `123`\n   http://localhost:8000/admin/sample_app/modelwithupdatelog/1/change/\nto explore the `update logs` and `navigation` feature \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "1 sam_djtools.DbUtils, 2 sam_djtools.EmailUtils, 3. sam_djtools.GeneralUtils 4. Primary key based form navigation to explore next/prev records.",
    "version": "1.2.42",
    "project_urls": {
        "Changelog": "https://github.com/humblesami/sam-djtools/CHANGES.rst",
        "Code": "https://github.com/humblesami/sam-djtools",
        "Homepage": "https://github.com/humblesami/sam-djtools.git",
        "Issue tracker": "https://github.com/humblesami/sam-djtools/issues"
    },
    "split_keywords": [
        "djtools",
        " django-tools",
        " form-navigation",
        " email-in-thread"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff5ec9752f748f534843e5f0c28bcb1c24da5f9f31a90fd9d08aa167503de6fe",
                "md5": "2cd381b3ea8c6f8b8bf562cd0764d624",
                "sha256": "60dc50d665f12e882ff96a50de7ec7e56d5f74be208a3511434f4d5074eaa128"
            },
            "downloads": -1,
            "filename": "sam_djtools-1.2.42-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2cd381b3ea8c6f8b8bf562cd0764d624",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 11188,
            "upload_time": "2024-11-10T20:46:57",
            "upload_time_iso_8601": "2024-11-10T20:46:57.673373Z",
            "url": "https://files.pythonhosted.org/packages/ff/5e/c9752f748f534843e5f0c28bcb1c24da5f9f31a90fd9d08aa167503de6fe/sam_djtools-1.2.42-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6446902cfe73483e52c393d76518a9fe3773c97b9dfeda5bb1036c3f290a4bf",
                "md5": "58a015f1347444e4978248b5fc6a67cf",
                "sha256": "448bd28c6543c702d933df5990bfb920c38dd1a0d044f788b823f533f0ca77da"
            },
            "downloads": -1,
            "filename": "sam_djtools-1.2.42.tar.gz",
            "has_sig": false,
            "md5_digest": "58a015f1347444e4978248b5fc6a67cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 16453,
            "upload_time": "2024-11-10T20:46:59",
            "upload_time_iso_8601": "2024-11-10T20:46:59.429625Z",
            "url": "https://files.pythonhosted.org/packages/d6/44/6902cfe73483e52c393d76518a9fe3773c97b9dfeda5bb1036c3f290a4bf/sam_djtools-1.2.42.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-10 20:46:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "humblesami",
    "github_project": "sam-djtools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "1.2.2.post1"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "70.0.0"
                ]
            ]
        }
    ],
    "lcname": "sam-djtools"
}
        
Elapsed time: 1.68369s