Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSGGR-209 Territory ownership and order limits #80

Merged
merged 6 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.http import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django_extended_ol.forms.widgets import WMTSWidget
from django.contrib.auth.models import Group

from .helpers import send_geoshop_email
from .models import (
Expand All @@ -24,7 +25,8 @@
OrderItem,
Pricing,
Product,
ProductFormat)
ProductFormat,
ProductOwnership)

UserModel = get_user_model()

Expand Down Expand Up @@ -188,17 +190,22 @@ def response_change(self, request, obj):
return HttpResponseRedirect(redirect_url)
return super().response_change(request, obj)

class ProductOwnershipAdmin(CustomGeoModelAdmin):
pass

class ProductOwnershipInline(admin.TabularInline):
model = ProductOwnership
extra = 1

class ProductAdmin(CustomGeoModelAdmin):
save_as = True
inlines = [ProductFormatInline]
inlines = [ProductFormatInline, ProductOwnershipInline]
raw_id_fields = ('metadata', 'group')
exclude = ('ts',)
search_fields = ['label']
list_filter = ('product_status',)
readonly_fields = ('thumbnail_tag',)


class AbstractIdentityAdmin(CustomModelAdmin):
list_display = ['last_name', 'first_name', 'company_name', 'email']
search_fields = ['first_name', 'last_name', 'company_name', 'email']
Expand Down Expand Up @@ -281,3 +288,4 @@ def response_change(self, request, obj):
admin.site.register(Pricing, PricingAdmin)
admin.site.register(Product, ProductAdmin)
admin.site.register(ProductFormat)
admin.site.register(ProductOwnership, ProductOwnershipAdmin)
Loading
Loading