Add Premium feature with UI, model changes, and admin configuration
This commit is contained in:
parent
95111240bc
commit
abe4a1a965
7 changed files with 156 additions and 6 deletions
|
|
@ -1,3 +1,24 @@
|
|||
from django.contrib import admin
|
||||
from .models import Profile
|
||||
|
||||
# Register your models here.
|
||||
|
||||
@admin.register(Profile)
|
||||
class ProfileAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'user',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'is_premium',
|
||||
'birth_date',
|
||||
)
|
||||
search_fields = (
|
||||
'user__username',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'biography',
|
||||
)
|
||||
list_filter = (
|
||||
'is_premium',
|
||||
'birth_date',
|
||||
)
|
||||
autocomplete_fields = ('user',)
|
||||
|
|
|
|||
18
users/migrations/0003_profile_is_premium.py
Normal file
18
users/migrations/0003_profile_is_premium.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 6.0 on 2025-12-10 21:27
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0002_alter_profile_avatar'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='profile',
|
||||
name='is_premium',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
|
|
@ -11,6 +11,7 @@ class Profile(models.Model):
|
|||
last_name = models.CharField(max_length=64, blank=True)
|
||||
birth_date = models.DateField(null=True, blank=True)
|
||||
biography = models.TextField(blank=True)
|
||||
is_premium = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
Loading…
Add table
Add a link
Reference in a new issue