Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
django-nativeshortuuidfield
Advanced tools
Provides a NativeShortUUIDField for your Django models which uses the base-57 "Short UUID" package at https://github.com/stochastic-technologies/shortuuid/ to be used in Python and store it as full UUID in database.
Install it with pip (or easy_install):
$ pip install django-nativeshortuuidfield
First you'll need to add a NativeShortUUIDField to your class:
from native_shortuuid import NativeShortUUIDField
class MyModel(models.Model):
uuid = NativeShortUUIDField(unique=True, default=uuid.uuid4)
If you want to add the ability to search by shortuuid in ModelAdmin
you need to inherit NativeUUIDSearchMixin
from native_shortuuid.admin import NativeUUIDSearchMixin
@admin.register(models.MyModel)
class MyModelAdmin(NativeUUIDSearchMixin, admin.ModelAdmin):
search_fields = ('uuid', )
If you want to have to ability to write your own uuid search fields list
from native_shortuuid.admin import NativeUUIDSearchMixin
@admin.register(models.MyModel)
class MyModelAdmin(NativeUUIDSearchMixin, admin.ModelAdmin):
admin_auto_extract_uuid_search_fields = False
search_fields = ('name', )
search_uuid_fields = ['uuid', 'foreign_model__uuid']
Enjoy!
ADMIN_AUTO_EXTRACT_UUID_SEARCH_FIELDS
: default True
search_uuid_fields
in the ModelAdmins that inherits NativeUUIDSearchMixin
with all shortuuid fields that are in the search_fields
array.
if you turned it off, you'll need to define search_uuid_fields
on you ModelAdmin in order to search on shortuuid fieldsNativeShortUUIDField is a subclass of django.db.models.UUIDField
You can pass usual Django UUIDField parameters on init, although some of them are added/overwritten:
setup.py
to the new version that the new pull request represents.After the pull request gets merged into the master branch a new release should be created
Create a new tag with the same version number you updated the setup.py
with:
$ git checkout master
$ git tag -a 2.1.0 -m 'fix importing order'
$ git push origin 2.1.0
Go to GitHub's releases section and create a new release:
FAQs
A decoder/encoder Field for uuid
We found that django-nativeshortuuidfield demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.