Changes to payment models #32

Merged
valberg merged 35 commits from benjaoming/membersystem:payment-updates into main 2024-08-03 17:55:33 +00:00
2 changed files with 23 additions and 7 deletions
Showing only changes of commit 5055095c6b - Show all commits

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