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
40cd84b6
authored
Jul 29, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix RuntimeWarning for naive datetime objects
parent
df98d5cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
django_sshkey/models.py
+7
-4
No files found.
django_sshkey/models.py
View file @
40cd84b6
...
@@ -26,13 +26,16 @@
...
@@ -26,13 +26,16 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import
datetime
from
django.db
import
models
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
from
django.db.models.signals
import
pre_save
from
django.db.models.signals
import
pre_save
from
django.dispatch
import
receiver
from
django.dispatch
import
receiver
try
:
from
django.utils.timezone
import
now
except
ImportError
:
import
datetime
now
=
datetime
.
datetime
.
now
from
django_sshkey.util
import
PublicKeyParseError
,
pubkey_parse
from
django_sshkey.util
import
PublicKeyParseError
,
pubkey_parse
from
django_sshkey
import
settings
from
django_sshkey
import
settings
...
@@ -101,11 +104,11 @@ class UserKey(models.Model):
...
@@ -101,11 +104,11 @@ class UserKey(models.Model):
def
save
(
self
,
*
args
,
**
kwargs
):
def
save
(
self
,
*
args
,
**
kwargs
):
if
kwargs
.
pop
(
'update_last_modified'
,
True
):
if
kwargs
.
pop
(
'update_last_modified'
,
True
):
self
.
last_modified
=
datetime
.
datetime
.
now
()
self
.
last_modified
=
now
()
super
(
UserKey
,
self
)
.
save
(
*
args
,
**
kwargs
)
super
(
UserKey
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
touch
(
self
):
def
touch
(
self
):
self
.
last_used
=
datetime
.
datetime
.
now
()
self
.
last_used
=
now
()
self
.
save
(
update_last_modified
=
False
)
self
.
save
(
update_last_modified
=
False
)
@receiver
(
pre_save
,
sender
=
UserKey
)
@receiver
(
pre_save
,
sender
=
UserKey
)
...
...
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