Admin for Member model, not for User
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
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)
|
payment_type = models.ForeignKey("PaymentType", on_delete=models.PROTECT)
|
||||||
external_transaction_id = models.CharField(max_length=255, default="", blank=True)
|
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:
|
class Meta:
|
||||||
verbose_name = _("payment")
|
verbose_name = _("payment")
|
||||||
|
|
|
@ -1,22 +1,38 @@
|
||||||
"""Admin configuration for membership app."""
|
"""Admin configuration for membership app."""
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth.admin import UserAdmin
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from .models import Membership
|
from . import models
|
||||||
from .models import MembershipType
|
|
||||||
from .models import SubscriptionPeriod
|
# Do not use existing user admin
|
||||||
|
admin.site.unregister(User)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Membership)
|
@admin.register(models.Membership)
|
||||||
class MembershipAdmin(admin.ModelAdmin):
|
class MembershipAdmin(admin.ModelAdmin):
|
||||||
"""Admin for Membership model."""
|
"""Admin for Membership model."""
|
||||||
|
|
||||||
|
|
||||||
@admin.register(MembershipType)
|
@admin.register(models.MembershipType)
|
||||||
class MembershipTypeAdmin(admin.ModelAdmin):
|
class MembershipTypeAdmin(admin.ModelAdmin):
|
||||||
"""Admin for MembershipType model."""
|
"""Admin for MembershipType model."""
|
||||||
|
|
||||||
|
|
||||||
@admin.register(SubscriptionPeriod)
|
@admin.register(models.SubscriptionPeriod)
|
||||||
class SubscriptionPeriodAdmin(admin.ModelAdmin):
|
class SubscriptionPeriodAdmin(admin.ModelAdmin):
|
||||||
"""Admin for SubscriptionPeriod model."""
|
"""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