|
Revision 1, 0.5 KB
(checked in by 235, 4 years ago)
|
|
re-comminting after curios incident with same filenames in upper and lower case`
|
| Line | |
|---|
| 1 | # Copyright (c) 2007 Brandon Low |
|---|
| 2 | # Licensed under the GPL v2 |
|---|
| 3 | from datetime import datetime, timedelta |
|---|
| 4 | from django.db import models |
|---|
| 5 | from settings import TIMEOUT |
|---|
| 6 | |
|---|
| 7 | class Captcha(models.Model): |
|---|
| 8 | text = models.CharField(max_length=10) |
|---|
| 9 | date = models.DateTimeField(auto_now_add=True) |
|---|
| 10 | |
|---|
| 11 | @staticmethod |
|---|
| 12 | def clean_expired(): |
|---|
| 13 | # Clean out expired Captchas first |
|---|
| 14 | expired_before = datetime.now()-timedelta(minutes=TIMEOUT) |
|---|
| 15 | Captcha.objects.filter(date__lt=expired_before).delete() |
|---|
| 16 | |
|---|
| 17 | class Meta: |
|---|
| 18 | db_table = 'plesonet_captcha' |
|---|