Renamed subscription

This commit is contained in:
Zak Timson 2017-08-18 22:55:17 -04:00
parent 3a96c13ad5
commit fd433ef9f6
2 changed files with 4 additions and 8 deletions

View File

@ -2,15 +2,15 @@ from django.contrib import admin
from django.contrib.auth.admin import User from django.contrib.auth.admin import User
from django.utils import timezone from django.utils import timezone
from .models import Newsletter, Subscriber from .models import Newsletter, NewsletterSubscription
class SubscriberInline(admin.StackedInline): class SubscriberInline(admin.StackedInline):
can_delete = False can_delete = False
extra = 1
fields = ['subscribed'] fields = ['subscribed']
max_num = 1 max_num = 1
model = Subscriber model = NewsletterSubscription
verbose_name = 'Newsletter'
class ExtendUserAdmin(admin.ModelAdmin): class ExtendUserAdmin(admin.ModelAdmin):
@ -20,7 +20,6 @@ class ExtendUserAdmin(admin.ModelAdmin):
inlines = [SubscriberInline] inlines = [SubscriberInline]
def newsletter(self, obj): def newsletter(self, obj):
print(vars(obj))
return bool(True) return bool(True)
newsletter.boolean = True newsletter.boolean = True

View File

@ -14,9 +14,6 @@ class Newsletter(models.Model):
return self.subject return self.subject
class Subscriber(models.Model): class NewsletterSubscription(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE) user = models.OneToOneField(User, on_delete=models.CASCADE)
subscribed = models.BooleanField(default=False) subscribed = models.BooleanField(default=False)
def __str__(self):
return ''