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
-
pip install sam-djtools
-
Add
sam_djtools
in installed apps insettings.py
of django projectINSTALLED_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
-
git clone https://github.com/humblesami/sam-djtools.git
-
cd sample_usage
-
pip install -r requirements.txt
-
python manage.py resetdb
- This step will delete db (if engine is sqlite or posgtgresql)
- will make makemigrations and migrate
- will create db
- create a super user
admin@localhost
with password123
- Will create three records of
ModelWithUpdateLog
-
python manage.py runsever
Features
- You can import and use
GeneralUtils, EmailUtils, DbUtils
having variety of methods which we commonly would need to write in django project - Form navigation => while changing/reading records in form, you n=can navigate to next/prev records
- 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 - The sample app contains a model (as following) inherited from
SamModel
and theSamModel
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 448bd28c6543c702d933df5990bfb920c38dd1a0d044f788b823f533f0ca77da |
|
MD5 | 58a015f1347444e4978248b5fc6a67cf |
|
BLAKE2b-256 | d6446902cfe73483e52c393d76518a9fe3773c97b9dfeda5bb1036c3f290a4bf |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60dc50d665f12e882ff96a50de7ec7e56d5f74be208a3511434f4d5074eaa128 |
|
MD5 | 2cd381b3ea8c6f8b8bf562cd0764d624 |
|
BLAKE2b-256 | ff5ec9752f748f534843e5f0c28bcb1c24da5f9f31a90fd9d08aa167503de6fe |