Skip to content

Commit

Permalink
5994 add management commands for discount management add versioning s…
Browse files Browse the repository at this point in the history
…upport for discounts (#169)

* create codes

* Update discounts

* update working

* fix

* expire now

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add examples

* formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* formatting

* foramtting

* Address some updates

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update with prefix

* disable based on prefix

* migrations fixed

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* rename migration

* code review comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* code review comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* git ignore csv

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cp-at-mit and pre-commit-ci[bot] authored Nov 18, 2024
1 parent 2989fef commit 094d3d5
Show file tree
Hide file tree
Showing 14 changed files with 979 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ config/keycloak/tls/tls.key

# Docker Compose override
docker-compose.override.yml

# Bulk discount csv
generated-codes.csv
16 changes: 13 additions & 3 deletions payments/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ def get_queryset(self, request):


@admin.register(models.Discount)
class DiscountAdmin(admin.ModelAdmin):
"""Admin for Discount"""

class DiscountAdmin(VersionAdmin):
model = models.Discount
search_fields = ["discount_type", "redemption_type", "discount_code"]
list_display = [
Expand Down Expand Up @@ -222,6 +220,18 @@ class RedeemedDiscountAdmin(admin.ModelAdmin):
list_filter = ["discount", "order", "user"]


@admin.register(models.BulkDiscountCollection)
class BulkDiscountCollectionAdmin(VersionAdmin):
"""Admin for BulkDiscountCollection"""

model = models.BulkDiscountCollection
search_fields = ["prefix"]
list_display = [
"prefix",
]
list_filter = ["prefix"]


@admin.register(models.BlockedCountry)
class BlockedCountryAdmin(SafeDeleteAdmin):
"""Admin for BlockedCountry"""
Expand Down
Loading

0 comments on commit 094d3d5

Please sign in to comment.