Mercurial > public > sg101
comparison contests/models.py @ 1035:eeaf387803c6
Remove usages of @models.permalink.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Dec 2015 21:33:55 -0600 |
parents | 5ba2508939f7 |
children |
comparison
equal
deleted
inserted
replaced
1034:2f36abf65a62 | 1035:eeaf387803c6 |
---|---|
3 | 3 |
4 """ | 4 """ |
5 import random | 5 import random |
6 import datetime | 6 import datetime |
7 | 7 |
8 from django.contrib.auth.models import User | |
9 from django.core.urlresolvers import reverse | |
8 from django.db import models | 10 from django.db import models |
9 from django.contrib.auth.models import User | |
10 | 11 |
11 | 12 |
12 class PublicContestManager(models.Manager): | 13 class PublicContestManager(models.Manager): |
13 """ | 14 """ |
14 The manager for all public contests. | 15 The manager for all public contests. |
49 ordering = ['-creation_date'] | 50 ordering = ['-creation_date'] |
50 | 51 |
51 def __unicode__(self): | 52 def __unicode__(self): |
52 return self.title | 53 return self.title |
53 | 54 |
54 @models.permalink | |
55 def get_absolute_url(self): | 55 def get_absolute_url(self): |
56 return ('contests-contest', [], {'slug': self.slug}) | 56 return reverse('contests-contest', kwargs={'slug': self.slug}) |
57 | 57 |
58 def save(self, *args, **kwargs): | 58 def save(self, *args, **kwargs): |
59 if not self.pk and not self.creation_date: | 59 if not self.pk and not self.creation_date: |
60 self.creation_date = datetime.datetime.now() | 60 self.creation_date = datetime.datetime.now() |
61 | 61 |