Skip to main content

1 sam_djtools.DbUtils, 2 sam_djtools.EmailUtils, 3. sam_djtools.GeneralUtils 4. Primary key based form navigation to explore next/prev records.

Project description

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

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

sam_djtools-1.2.42.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

sam_djtools-1.2.42-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file sam_djtools-1.2.42.tar.gz.

File metadata

  • Download URL: sam_djtools-1.2.42.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for sam_djtools-1.2.42.tar.gz
Algorithm Hash digest
SHA256 448bd28c6543c702d933df5990bfb920c38dd1a0d044f788b823f533f0ca77da
MD5 58a015f1347444e4978248b5fc6a67cf
BLAKE2b-256 d6446902cfe73483e52c393d76518a9fe3773c97b9dfeda5bb1036c3f290a4bf

See more details on using hashes here.

File details

Details for the file sam_djtools-1.2.42-py3-none-any.whl.

File metadata

  • Download URL: sam_djtools-1.2.42-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for sam_djtools-1.2.42-py3-none-any.whl
Algorithm Hash digest
SHA256 60dc50d665f12e882ff96a50de7ec7e56d5f74be208a3511434f4d5074eaa128
MD5 2cd381b3ea8c6f8b8bf562cd0764d624
BLAKE2b-256 ff5ec9752f748f534843e5f0c28bcb1c24da5f9f31a90fd9d08aa167503de6fe

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