Admin for Member model, not for User
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Benjamin Bach 2024-07-21 16:10:20 +02:00
parent 1f28ffc9c5
commit 5055095c6b
No known key found for this signature in database
GPG key ID: 486F0D69C845416E
2 changed files with 23 additions and 7 deletions

View file

@ -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")

View file

@ -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,)