core: add is_link and get_url property to base Source

This commit is contained in:
Jens Langhammer
2018-12-18 13:24:58 +01:00
parent f6c5f10d65
commit b0fa302718
3 changed files with 24 additions and 0 deletions

View File

@ -1,6 +1,7 @@
"""OAuth Client models"""
from django.db import models
from django.urls import reverse_lazy
from django.utils.translation import gettext as _
from passbook.core.models import Source, UserSourceConnection
@ -20,6 +21,15 @@ class OAuthSource(Source):
form = 'passbook.oauth_client.forms.GitHubOAuthSourceForm'
@property
def is_link(self):
return True
@property
def get_url(self):
return reverse_lazy('passbook_oauth_client:oauth-client-login',
kwargs={'source_slug': self.slug})
class Meta:
verbose_name = _('Generic OAuth Source')