Browse code

registered user support

devnewton authored on 03/01/2012 at 09:22:10
Showing 1 changed files
... ...
@@ -29,7 +29,8 @@ class Level(models.Model):
29 29
 
30 30
 class Player(models.Model):
31 31
     slug = models.SlugField(max_length=80, unique=True)
32
-    secret = models.SlugField(max_length=80, unique=True)
32
+    secret = models.SlugField(max_length=80)
33
+    registered = models.BooleanField(default=False)
33 34
     @models.permalink
34 35
     def get_absolute_url(self):
35 36
         return ('scorekeeper.views.player_detail', [str(self.slug)])
... ...
@@ -39,7 +40,7 @@ class Player(models.Model):
39 39
         return self.score_set.all().order_by('-level__name', '-score')
40 40
     @staticmethod
41 41
     def cleanup():
42
-        for player in Player.objects.annotate(num_scores = models.Count('score')).filter(num_scores = 0):
42
+        for player in Player.objects.annotate(num_scores = models.Count('score')).filter(num_scores = 0, registered=False):
43 43
             player.delete()
44 44
 
45 45
 class Score(models.Model):