lfs-criterion-extra
Added more criterions to lfs based shop
Installation
installation is simple
pip install lfs-criterion-extra
or
pip install git+https://github.com/suvit/lfs-criterion-extra
After instalation of the package you should add lfs_criterion_extra to INSTALLED_APPS before lfs app. This is because, this app overwrite lfs templates.
After that you needed to add tables in db
python manage.py syncdb
That`s all.
Usage
lfs-criterion-extra patch lfs criterions modules to support new criterions. After patching you may use several new criterions:
- OrderCountCriterion
checks closed order count of request.user
- GroupCriterion
checks request.user is in saved group(s)
- CategoryCriterion
checks product or products in cart are in saved categories
- ProductCriterion
checks product or products in cart are in saved list of products
- OrderCompositionCriterion
checks that in cart
- DiscountCriterion
checks that saved discounts are valid or unvalid
- OrderSummCriterion
checks closed order summ of prices
- ManufacturerCriterion
checks product`s manufacturer is in saved list of manufacturers
- TimeCriterion
checks now time to compare with saved time
- CartAmountCriterion
checks cart amount
- MaxWeightCriterion
chacks max weight of the products in cart
- ForSaleCriterion
checks product or products in cart are for_sale
- ManualDeliveryTimeCriterion
checks product or products in cart are with manual delivery time
- FullUserCriterion (AdvancedUserCriterion)
added ability to check that user is anonymous or not.
- ProfitCriterion (not worked with base lfs, needed prices from supplier)
checks product profit
You may choose new criterions from criterion`s tab of delivery and payment methods.
Added own criterions
You may inherit Criterion or NumberCriterion
from lfs_criterion_extra.models import Criterion, NumberCriterion
- class FooCriterion(NumberCriterion):
foo = models.DecimalField(‘FOO’)
‘may be other model fields’
value_attr = ‘foo’ # from that attribute get value to compare content_type = ‘foo’ # internal id of the criterion name = ‘Foo’ # displayable value
- def is_valid(self, request, product=None):
how_many_foo = product.name.count(‘foo’) return self.test_value(how_many_foo)
that`s all, your criterion is appeared in the criterion list.
TODO
move monkey.py to lfs.criterion.core (merge or move to lfs 0.8)
write tests
Metadata
Release files for lfs_criterion_extra 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lfs_criterion_extra-0.2.0.zip | 29.2 kB | Without provenance | Details |
Release files / lfs_criterion_extra-0.2.0.zip
| Download URL | lfs_criterion_extra-0.2.0.zip |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
377c7004eb8cf97c8c2af5a4e7a6ad05cadb59c25f9c3e6398bbdcdd8869bbe5
|
|
BLAKE2b-256 checksum How to use checksums |
a3405e92f2540c2f642abeb95c8710c8e4beb9f75f7acbe065452b0a5b70ccb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lfs_criterion_extra 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.