1 from django.db import models
2 from django.contrib.auth.models import User
3 from django.utils.translation import ugettext_lazy as _
5 __all__ = ['ServiceTicket', 'LoginTicket']
7 class ServiceTicket(models.Model):
8 user = models.ForeignKey(User, verbose_name=_('user'))
9 service = models.URLField(_('service'), verify_exists=False)
10 ticket = models.CharField(_('ticket'), max_length=256)
11 created = models.DateTimeField(_('created'), auto_now=True)
14 verbose_name = _('Service Ticket')
15 verbose_name_plural = _('Service Tickets')
17 def __unicode__(self):
18 return "%s (%s) - %s" % (self.user.username, self.service, self.created)
20 class LoginTicket(models.Model):
21 ticket = models.CharField(_('ticket'), max_length=32)
22 created = models.DateTimeField(_('created'), auto_now=True)
25 verbose_name = _('Login Ticket')
26 verbose_name_plural = _('Login Tickets')
28 def __unicode__(self):
29 return "%s - %s" % (self.ticket, self.created)