Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The djangobible library is a Django app that wraps the pythonbible library and provides models, managers, and other tools to easily index an object by a scripture reference.
Pip install the djangobible library.
pip install djangobible
Add djangobible to your Django project's INSTALLED_APPS
setting:
INSTALLED_APPS = [
..., # other apps
"djangobible",
]
Run the django migrations for djangobible
./manage.py migrate djangobible
There currently are no settings (other than INSTALLED_APPS) related to the djangobible project. In the future, it would be nice to have settings that determine things like the available versions of the Bible and the default version.
Also, once support is implemented for multiple locales and languages, there could be related settings for that functionality.
The djangobible library is a complete wrapper for the pythonbible library, so importing the djangobible library as:
import djangobible as bible
will provide all the same functionality as importing the pythonbible library as:
import pythonbible as bible
This includes features such as:
For more information, see the pythonbible documentation.
In addition, the djangobible library includes the following features:
There are currently two template tags provided by the djangobible library: verse_reference
and verse_text
.
The verse_reference
template tag, given a verse ID and a Bible version, returns the appropriate Scripture reference string.
For example, given verse_id = 1001001
and version = djangobible.Version.KING_JAMES
, the following snippet from a Django template:
{% load verse_tags %}
...
{% verse_reference verse_id version=version %}
would display:
Genesis 1:1
The version parameter is optional, and the current default is King James, though that will ideally be configurable in the future.
There is another optional parameter, full_title
, which is a boolean flag to determine whether to display the long version or the short version of the book of the Bible title. It defaults to False
, which displays the short version. For example, given verse_id = 1001001
and version = djangobible.Version.KING_JAMES
and full_title = True
, the following snippet from a Django template:
{% load verse_tags %}
...
{% verse_reference verse_id version=version full_title=full_title %}
would display:
The First Book of Moses, called Genesis 1:1
The verse_text
template tag, given a verse ID and a Bible version, returns the appropriate text of that Bible verse.
For example, given verse_id = 1001001
and version = djangobible.Version.KING_JAMES
, the following snippet from a Django template:
{% load verse_tags %}
...
{% verse_text verse_id %}
would display:
In the beginning God created the heaven and the earth.
The version parameter is optional, and the current default is King James, though that will ideally be configurable in the future.
For situations where an instance of a Django model needs to be associated with a single verse, that Django model can have a field of type VerseField
.
For example:
from django.db import models
import djangobible as bible
class MyModel(models.Model):
... # other fields
verse = bible.VerseField()
The underlying implementation of VerseField
is an IntegerField
which stores the verse ID of the associated verse.
Having this custom field type provides several benefits:
MyModel.objects.filter(verse=1001001)
is valid, but so is MyModel.objects.filter(verse="Genesis 1:1")
).You can set the verse field with either the int verse ID or the string reference:
my_object = MyModel.objects.create(name="my object")
my_object.verse = 1001001
my_object.save()
or
my_object = MyModel.objects.create(name="my object")
my_object.verse = "Genesis 1:1"
my_object.save()
You can filter the objects in the query set by either the int verse ID or the string reference:
MyModel.objects.filter(verse=1001001)
or
MyModel.objects.filter(verse="Genesis 1:1")
In any of the above examples, if the verse is not a valid verse ID integer or string reference for a single verse, then a ValidationError
will be raised.
WARNING: This is still a work in progress, and this functionality does not yet exist in a stable form.
There are situations where an instance of a Django model needs to be associated with multiple verses. The current intended solution, inspired by the django-taggit library, is to implement this feature in such a way that you would add this relationship to your model like:
from django.db import models
import djangobible as bible
class MyModel(models.Model):
... # other fields
verses = bible.VerseManager()
Then you could add, remove, and reference those verses with something like:
>>> my_object = MyModel.objects.create(name="My Object")
>>> my_object.verses.add("Genesis 1:1-3")
>>> my_object.verses.all()
[<Verse: Genesis 1:1>, <Verse: Genesis 1:2>, <Verse: Genesis 1:3>]
>>> my_object.verses.remove("Genesis 1:2")
>>> my_object.verses.all()
[<Verse: Genesis 1:1>, <Verse: Genesis 1:3>]
>>> MyModel.objects.filter(verses__in=[1001001])
[<MyModel: My Object>]
Ideally, the form field would be a text field where the user could enter a list of Scripture references (e.g. "Genesis 1:1,3-10;Psalm 119;Luke 2:1-18;John 3:16")
FAQs
djangobible python library.
We found that djangobible demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.