Hi all,
I need to make a `passwordless` token system, and want to have a "Home ›
Passwordless › User tokens" in the Admin section. For the "User tokens"
`list_display` I need all the "Users". (I do _not_ want to display the
token information on the regular "User"-admin as just an extended
"profile".)
Any ideas on how to go about doing this?
So far I have this skeleton in `passwordless/model.py`, but I probably need
some magic in `passwordless/admin.py` to list all the users with links to a
custom token-manager form with custom widgets (create-token button, delete
token button etc)...
from django.db import models
import jwt
class UserTokens(models.Model):
class Meta:
verbose_name = "User tokens"
verbose_name_plural = "User tokens"
user = models.OneToOneField(User)
class TokenBase(models.Model):
class Meta:
abstract = True
token = models.CharField(max_length=1000)
created_ts = models.DateTimeField('Date created')
expires_ts = models.DateTimeField('Date expired')
def __str__(self):
return self.user.email
class AuthenticateToken(TokenBase):
manager = models.OneToOneField(UserTokens)
def validate(self, token):
pass
class AuthorizeToken(TokenBase):
manager = models.ForeignKey(UserTokens)
revoked_ts = models.DateTimeField('Date revoked')
def validate(self, token):
pass
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a5bd42c5-bb3d-4a84-a50d-2d24fb5b0261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.