Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a14a3504
authored
Oct 09, 2014
by
Paul Kilgo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ContentType fkey to Key
parent
b56c4574
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
django_sshkey/models.py
+8
-0
No files found.
django_sshkey/models.py
View file @
a14a3504
...
...
@@ -28,6 +28,7 @@
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.contrib.contenttypes.models
import
ContentType
from
django.core.exceptions
import
ValidationError
from
django.db.models.signals
import
pre_save
,
post_delete
from
django.dispatch
import
receiver
...
...
@@ -43,6 +44,7 @@ class Key(models.Model):
key
=
models
.
TextField
(
max_length
=
2000
)
fingerprint
=
models
.
CharField
(
max_length
=
47
,
blank
=
True
,
db_index
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
)
content_type
=
models
.
ForeignKey
(
ContentType
)
last_modified
=
models
.
DateTimeField
(
null
=
True
)
last_used
=
models
.
DateTimeField
(
null
=
True
)
...
...
@@ -109,6 +111,12 @@ class ApplicationKey(models.Model):
class
Meta
:
abstract
=
True
@classmethod
def
base
(
cls
,
**
kw
):
if
not
'content_type'
in
kw
:
kw
[
'content_type'
]
=
ContentType
.
objects
.
get_for_model
(
cls
)
return
Key
(
**
kw
)
def
__unicode__
(
self
):
try
:
return
unicode
(
self
.
basekey
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment