Renamed subscription
This commit is contained in:
parent
3a96c13ad5
commit
fd433ef9f6
@ -2,15 +2,15 @@ from django.contrib import admin
|
||||
from django.contrib.auth.admin import User
|
||||
from django.utils import timezone
|
||||
|
||||
from .models import Newsletter, Subscriber
|
||||
from .models import Newsletter, NewsletterSubscription
|
||||
|
||||
|
||||
class SubscriberInline(admin.StackedInline):
|
||||
can_delete = False
|
||||
extra = 1
|
||||
fields = ['subscribed']
|
||||
max_num = 1
|
||||
model = Subscriber
|
||||
verbose_name = 'Newsletter'
|
||||
model = NewsletterSubscription
|
||||
|
||||
|
||||
class ExtendUserAdmin(admin.ModelAdmin):
|
||||
@ -20,7 +20,6 @@ class ExtendUserAdmin(admin.ModelAdmin):
|
||||
inlines = [SubscriberInline]
|
||||
|
||||
def newsletter(self, obj):
|
||||
print(vars(obj))
|
||||
return bool(True)
|
||||
newsletter.boolean = True
|
||||
|
||||
|
@ -14,9 +14,6 @@ class Newsletter(models.Model):
|
||||
return self.subject
|
||||
|
||||
|
||||
class Subscriber(models.Model):
|
||||
class NewsletterSubscription(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
subscribed = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return ''
|
||||
|
Loading…
Reference in New Issue
Block a user