SHARE
TWEET

Untitled

a guest Jun 17th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Season(models.Model):
  2.     season = models.CharField(max_length=4)
  3.     start_date = models.DateTimeField()
  4.     end_date = models.DateTimeField()
  5.  
  6.  
  7. class Challenge(models.Model):
  8.     season = models.ForeignKey(Season, on_delete=models.CASCADE)
  9.     name = models.CharField(max_length=255)
  10.     start_date = models.DateTimeField()
  11.     end_date = models.DateTimeField()
  12.  
  13. class Attempt(models.Model):
  14.     challenger = models.ForeignKey(User, on_delete=models.CASCADE)
  15.     challenge = models.ForeignKey(Challenge, on_delete=models.CASCADE)
  16.     points = models.IntegerField(default=0)
  17.      
  18. Season(season='2019',
  19.        start_date=...,  # some date object
  20.        end_date=...,  # some date object
  21. )
  22.  
  23. Challenge(season=1,  # represents season object above
  24.           name='Challenge 1',
  25.           start_date=...,  # some date object
  26.           end_date=...,  # some date object
  27. )
  28.  
  29. Challenge(season=1,  # represents season object above
  30.           name='Challenge 2',
  31.           start_date=...,  # some date object
  32.           end_date=...  # some date object
  33. )
  34.  
  35. Attempt(challenger=1,  # represents user object
  36.         challenge=1,  # represents challenge 1 above
  37.         points=5
  38. )
  39.  
  40. Attempt(challenger=2,  # represents user object
  41.         challenge=1,  # represents challenge 1 above
  42.         points=10
  43. )
  44.  
  45. Attempt(challenger=1,  # represents user object
  46.         challenge=2,  # represents challenge 2 above
  47.         points=5
  48. )
  49.  
  50.  
  51. Attempt(challenger=2,  # represents user object
  52.         challenge=2,  # represents challenge 2 above
  53.         points=10
  54. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top