Skip to main content

Package contain necessary tools to complement your Django ORM usage

Project description

Django-DB-Helper

Package contain necessary tools to complement your Django ORM usage.

Install

$  pip install django-db-helper

Usage

Get Object or None

Model.objects.get() is widely use in getting a single record from the database. A DoesNotExist exception is thrown when the record is not found. get_object_or_none returns None when no matching record is found. This method is very helpful because most developers do not handle DoesNotExist exception from Model.objects.get() since it is used in anticipation that a single matching record is available.

from django_db_helper.get_object_or_none import get_object_or_none

#### Format
get_object_or_none(Model,key1=value1,key2=value2,..)

#### Getting User Object from User Model with an available username

user = get_object_or_none(User,username="andrewsxx")

//=> user object


#### Getting User Object from User Model with an available username

user = get_object_or_none(User,username="andrewsxx1234")

//=> None

License

MIT © [Andrews Agyemang Opoku]

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_db_helper-0.0.2.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_db_helper-0.0.2-py2-none-any.whl (3.2 kB view details)

Uploaded Python 2

File details

Details for the file django_db_helper-0.0.2.tar.gz.

File metadata

  • Download URL: django_db_helper-0.0.2.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5

File hashes

Hashes for django_db_helper-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2240e933483084d8b801710db2233d6e68121af79812a46acd21cd2ff9b9c731
MD5 28fa9bd16e3726907f32a850c93928b8
BLAKE2b-256 0b544af422e18b99256d4c111fa8618c95cca2f78ce8864f0fefc782ffb39ce3

See more details on using hashes here.

File details

Details for the file django_db_helper-0.0.2-py2-none-any.whl.

File metadata

  • Download URL: django_db_helper-0.0.2-py2-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5

File hashes

Hashes for django_db_helper-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 7ec012f28105fc0b9d2d98a71dae87c13cd480f76ab77698ddc6a38b4e98a44f
MD5 98e7732eb9315fa42596a966e6728ea9
BLAKE2b-256 41923ece64da70e4e0d1b9e01f3a341f82095bb6ea2c199df000e04e25f06793

See more details on using hashes here.

Supported by

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