forked from data.coop/membersystem
Admin for Member model, not for User
This commit is contained in:
parent
1f28ffc9c5
commit
5055095c6b
|
@ -150,7 +150,7 @@ class Payment(CreatedModifiedAbstract):
|
|||
payment_type = models.ForeignKey("PaymentType", on_delete=models.PROTECT)
|
||||
external_transaction_id = models.CharField(max_length=255, default="", blank=True)
|
||||
|
||||
# stripe_charge_id = models.CharField(max_length=255, null=True, blank=True) # noqa: ERA001
|
||||
stripe_charge_id = models.CharField(max_length=255, default="", blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("payment")
|
||||
|
|
|
@ -1,22 +1,38 @@
|
|||
"""Admin configuration for membership app."""
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from .models import Membership
|
||||
from .models import MembershipType
|
||||
from .models import SubscriptionPeriod
|
||||
from . import models
|
||||
|
||||
# Do not use existing user admin
|
||||
admin.site.unregister(User)
|
||||
|
||||
|
||||
@admin.register(Membership)
|
||||
@admin.register(models.Membership)
|
||||
class MembershipAdmin(admin.ModelAdmin):
|
||||
"""Admin for Membership model."""
|
||||
|
||||
|
||||
@admin.register(MembershipType)
|
||||
@admin.register(models.MembershipType)
|
||||
class MembershipTypeAdmin(admin.ModelAdmin):
|
||||
"""Admin for MembershipType model."""
|
||||
|
||||
|
||||
@admin.register(SubscriptionPeriod)
|
||||
@admin.register(models.SubscriptionPeriod)
|
||||
class SubscriptionPeriodAdmin(admin.ModelAdmin):
|
||||
"""Admin for SubscriptionPeriod model."""
|
||||
|
||||
|
||||
class MembershipInlineAdmin(admin.TabularInline):
|
||||
"""Inline admin."""
|
||||
|
||||
model = models.Membership
|
||||
|
||||
|
||||
@admin.register(models.Member)
|
||||
class MemberAdmin(UserAdmin):
|
||||
"""Member admin is actually an admin for User objects."""
|
||||
|
||||
inlines = (MembershipInlineAdmin,)
|
||||
|
|
Loading…
Reference in a new issue