forked from GithubBackups/healthchecks
Fix tests. Fix "View Profile" link in Subscriptions admin
This commit is contained in:
parent
bc56da1d88
commit
8a68ea50dc
@ -22,13 +22,6 @@ class PruneUsersTestCase(BaseTestCase):
|
|||||||
self.assertEqual(User.objects.filter(username="charlie").count(), 0)
|
self.assertEqual(User.objects.filter(username="charlie").count(), 0)
|
||||||
self.assertEqual(Check.objects.count(), 0)
|
self.assertEqual(Check.objects.count(), 0)
|
||||||
|
|
||||||
def test_it_removes_old_users_with_zero_checks(self):
|
|
||||||
self.charlie.date_joined = self.year_ago
|
|
||||||
self.charlie.last_login = self.year_ago
|
|
||||||
self.charlie.save()
|
|
||||||
|
|
||||||
Command().handle()
|
|
||||||
self.assertEqual(User.objects.filter(username="charlie").count(), 0)
|
|
||||||
|
|
||||||
def test_it_leaves_team_members_alone(self):
|
def test_it_leaves_team_members_alone(self):
|
||||||
self.bob.date_joined = self.year_ago
|
self.bob.date_joined = self.year_ago
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
from hc.accounts.models import Profile
|
from hc.accounts.models import Profile
|
||||||
from hc.payments.models import Subscription
|
from hc.payments.models import Subscription
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ class SubsAdmin(admin.ModelAdmin):
|
|||||||
def email(self, obj):
|
def email(self, obj):
|
||||||
return obj.user.email if obj.user else None
|
return obj.user.email if obj.user else None
|
||||||
|
|
||||||
|
@mark_safe
|
||||||
def profile(self, obj):
|
def profile(self, obj):
|
||||||
if obj.user.profile:
|
if obj.user.profile:
|
||||||
url = reverse("admin:accounts_profile_change",
|
url = reverse("admin:accounts_profile_change",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user