Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-cas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-cas
Commits
c91b4ddf
Commit
c91b4ddf
authored
Nov 01, 2011
by
Sebastian Annies
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use correct construct for getting day before yesterday (timedelta instead of just now.day - 2)
parent
aad4f470
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
django_cas/models.py
+2
-2
No files found.
django_cas/models.py
View file @
c91b4ddf
...
@@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist
...
@@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist
from
django_cas.exceptions
import
CasTicketException
,
CasConfigException
from
django_cas.exceptions
import
CasTicketException
,
CasConfigException
# Ed Crewe - add in signals to delete old tickets
# Ed Crewe - add in signals to delete old tickets
from
django.db.models.signals
import
post_save
from
django.db.models.signals
import
post_save
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
django_cas
import
CAS
,
NSMAP
from
django_cas
import
CAS
,
NSMAP
class
Tgt
(
models
.
Model
):
class
Tgt
(
models
.
Model
):
...
@@ -66,7 +66,7 @@ def delete_old_tickets(**kwargs):
...
@@ -66,7 +66,7 @@ def delete_old_tickets(**kwargs):
"""
"""
sender
=
kwargs
.
get
(
'sender'
,
None
)
sender
=
kwargs
.
get
(
'sender'
,
None
)
now
=
datetime
.
now
()
now
=
datetime
.
now
()
expire
=
datetime
(
now
.
year
,
now
.
month
,
now
.
day
-
2
)
expire
=
datetime
(
now
.
year
,
now
.
month
,
now
.
day
)
-
timedelta
(
days
=
2
)
sender
.
objects
.
filter
(
created__lt
=
expire
)
.
delete
()
sender
.
objects
.
filter
(
created__lt
=
expire
)
.
delete
()
post_save
.
connect
(
delete_old_tickets
,
sender
=
PgtIOU
)
post_save
.
connect
(
delete_old_tickets
,
sender
=
PgtIOU
)
...
...
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