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.
django-oscar-pg-search
Advanced tools
This creates a search handler without the need of any search backend. It is designed for the e-commerce framework Oscar.
It is implemented a little bit expensive but uses 4 annotated search vectors: * upc * title * meta_description * meta_title
This way the search can be manipulated through the meta fields. It is running productive in a heavily customized env for many months now. I think it should scale up to 5000 Products with 10 Attributes depending on how the products are loaded. We use it fully lazy with endless scrolling.
Install using pip:
pip install django-oscar-pg-search
# settings.py
# replace 'oscar.apps.search.apps.SearchConfig' by 'oscar_pg_search.apps.PgSearchConfig'
INSTALLED_APPS = [
# 'oscar.apps.search.apps.SearchConfig',
'oscar_pg_search.apps.PgSearchConfig',
]
OSCAR_PRODUCT_SEARCH_HANDLER = 'oscar_pg_search.postgres_search_handler.PostgresSearchHandler'
# To avoid exception, haystack is not used:
HAYSTACK_CONNECTIONS = {"default": {}}
Trigram search is our search algorithm. Enable it at your database by executing the following sql:
CREATE EXTENSION pg_trgm;
To install the included Search box that passes the previous search term. (eg. in 'oscar/partials/search.html')
{% include 'oscar_pg_search/partials/search.html' %}
To use the included filter forms, include them in the template eg. in 'oscar/layout_2_col.html' after '{% block column_left_extra %}{% endblock %}'.
{% include 'oscar_pg_search/catalogue/partials/filter_forms.html' %}
and include the mixin into the catalogue views.
# apps/catalogue/views.py
from oscar.apps.catalogue import views
from oscar_pg_search.mixins import SearchViewMixin
class CatalogueView(SearchViewMixin, views.CatalogueView):
pass
class ProductCategoryView(SearchViewMixin, views.ProductCategoryView):
pass
To empower multiple choice fields with chosen load it eg. in 'oscar/base.html'.
# At the beginning:
{% load oscar_pg_search %}
# After jQuery is loaded:
{% oscar_pg_search_base %}
If you want to add some fields that are directly attached to the Product model:
# settings.py
OSCAR_ATTACHED_PRODUCT_FIELDS = ['is_public', 'deposit', 'volume', 'weight',]
FAQs
Pure Postgresql search backend for Django Oscar
We found that django-oscar-pg-search 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.