full passing test suite w. new stripe integration across multiple project nodes; new gameboard django app; stripe in test mode on staging
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import LoginToken, User
|
||||
from .models import LoginToken, Token, User
|
||||
|
||||
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
@@ -9,3 +9,4 @@ class UserAdmin(admin.ModelAdmin):
|
||||
|
||||
admin.site.register(User, UserAdmin)
|
||||
admin.site.register(LoginToken)
|
||||
admin.site.register(Token)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 6.0 on 2026-03-08 20:26
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lyric', '0006_token_wallet'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='stripe_customer_id',
|
||||
field=models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PaymentMethod',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('stripe_pm_id', models.CharField(max_length=255)),
|
||||
('last4', models.CharField(max_length=4)),
|
||||
('brand', models.CharField(max_length=32)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_methods', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -31,6 +31,7 @@ class User(AbstractBaseUser):
|
||||
username = models.CharField(max_length=35, unique=True, null=True, blank=True)
|
||||
searchable = models.BooleanField(default=False)
|
||||
palette = models.CharField(max_length=32, default="palette-default")
|
||||
stripe_customer_id = models.CharField(max_length=255, null=True, blank=True)
|
||||
|
||||
is_staff = models.BooleanField(default=False)
|
||||
is_superuser = models.BooleanField(default=False)
|
||||
@@ -78,6 +79,15 @@ class Token(models.Model):
|
||||
)
|
||||
return self.get_token_type_display()
|
||||
|
||||
class PaymentMethod(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="payment_methods")
|
||||
stripe_pm_id = models.CharField(max_length=255)
|
||||
last4 = models.CharField(max_length=4)
|
||||
brand = models.CharField(max_length=32)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.brand} ....{self.last4}"
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def create_wallet_and_tokens(sender, instance, created, **kwargs):
|
||||
if not created:
|
||||
|
||||
Reference in New Issue
Block a user