First import of migration to python 3
This commit is contained in:
@@ -19,11 +19,13 @@ along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
class UserProfile(models.Model):
|
||||
user = models.OneToOneField(User)
|
||||
user = models.OneToOneField(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
avatar = models.ImageField(upload_to="profiles/", blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
@@ -58,8 +60,14 @@ class Match(models.Model):
|
||||
group = models.IntegerField()
|
||||
matchday = models.IntegerField()
|
||||
matchday_name = models.CharField(max_length=128)
|
||||
idTeam1 = models.ForeignKey(Team, related_name='+')
|
||||
idTeam2 = models.ForeignKey(Team, related_name='+')
|
||||
idTeam1 = models.ForeignKey(
|
||||
Team, related_name='+',
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
idTeam2 = models.ForeignKey(
|
||||
Team, related_name='+',
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
pointsTeam1 = models.SmallIntegerField()
|
||||
pointsTeam2 = models.SmallIntegerField()
|
||||
finished = models.BooleanField()
|
||||
@@ -70,8 +78,14 @@ class Match(models.Model):
|
||||
return (str(self.matchID))
|
||||
|
||||
class Tipp(models.Model):
|
||||
matchID = models.ForeignKey(Match)
|
||||
tipperID = models.ForeignKey(User)
|
||||
matchID = models.ForeignKey(
|
||||
Match,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
tipperID = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
pointsTeam1 = models.PositiveSmallIntegerField()
|
||||
pointsTeam2 = models.PositiveSmallIntegerField()
|
||||
score = models.PositiveIntegerField(
|
||||
@@ -88,7 +102,10 @@ class Mandant(models.Model):
|
||||
return self.name
|
||||
|
||||
class Score(models.Model):
|
||||
client = models.ForeignKey(Mandant)
|
||||
client = models.ForeignKey(
|
||||
Mandant,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
exact_high = models.PositiveSmallIntegerField()
|
||||
exact = models.PositiveSmallIntegerField()
|
||||
diff = models.PositiveSmallIntegerField()
|
||||
@@ -97,8 +114,14 @@ class Score(models.Model):
|
||||
return str(self.client)
|
||||
|
||||
class chart(models.Model):
|
||||
team = models.ForeignKey(Team)
|
||||
competition = models.ForeignKey(Competition)
|
||||
team = models.ForeignKey(
|
||||
Team,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
competition = models.ForeignKey(
|
||||
Competition,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
points = models.PositiveSmallIntegerField()
|
||||
diff = models.SmallIntegerField()
|
||||
games = models.PositiveSmallIntegerField()
|
||||
@@ -107,8 +130,14 @@ class chart(models.Model):
|
||||
unique_together = ("team", "competition")
|
||||
|
||||
class RelUserMandant(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
mandant = models.ForeignKey(Mandant)
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
mandant = models.ForeignKey(
|
||||
Mandant,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("user", "mandant")
|
||||
@@ -119,7 +148,10 @@ class Post(models.Model):
|
||||
content = models.TextField()
|
||||
published = models.BooleanField(default=True)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
author = models.ForeignKey(User)
|
||||
author = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-created']
|
||||
@@ -128,8 +160,14 @@ class Post(models.Model):
|
||||
return u'%s' % self.created
|
||||
|
||||
class RelPostMandant(models.Model):
|
||||
post = models.ForeignKey(Post)
|
||||
mandant = models.ForeignKey(Mandant)
|
||||
post = models.ForeignKey(
|
||||
Post,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
mandant = models.ForeignKey(
|
||||
Mandant,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("post", "mandant")
|
||||
|
||||
Reference in New Issue
Block a user