from __future__ import unicode_literals

from django.db import models


class Server(models.Model):
    name = models.CharField(blank=True, max_length=100)

    def __str__(self):
        return self.name


class SpecType(models.Model):
    action = models.CharField(blank=True, max_length=100)

    def __str__(self):
        return self.action


class Specs(models.Model):
    image = models.ImageField(upload_to="/specs/", null=True, blank=True)
    name = models.CharField(blank=True, max_length=100)
    spec_type = models.ForeignKey(SpecType)

    def __str__(self):
        return self.name


class Classes(models.Model):
    image = models.ImageField(upload_to="/classes/", null=True, blank=True)
    name = models.CharField(blank=True, max_length=100)
    color = models.CharField(blank=True, max_length=100)
    specs = models.ManyToManyField(Specs)

    def __str__(self):
        return self.name


class Player(models.Model):
    image = models.ImageField(upload_to="/player/%Y/%m/%d/", null=True, blank=True)
    name = models.CharField(blank=True, max_length=100)
    ilvl = models.IntegerField(blank=True, null=True)
    lvl = models.IntegerField(blank=True, null=True)
    server = models.ForeignKey(Server)
    classe = models.ForeignKey(Classes)
    main_spec = models.ForeignKey(Specs)
    off_spec = models.ForeignKey(Specs)
    creation_date = models.DateField(auto_now_add=True)
    updated_date = models.DateField(auto_now=True)
    is_active = models.BooleanField(default=True)

    def __str__(self):
        return '{name} {ilvl}'.format(self.name, self.ilvl)

@@ -900,24 +900,502 @@
 self.name%0A%0A%0A
+class Game(models.Model):%0A    name = models.CharField(blank=True, max_length=100)%0A%0A    def __str__(self):%0A        return self.name%0A%0A%0Aclass Faction(models.Model):%0A    name = models.CharField(blank=True, max_length=100)%0A%0A    def __str__(self):%0A        return self.name%0A%0A%0Aclass Race(models.Model):%0A    name = models.CharField(blank=True, max_length=100)%0A    game = models.ForeignKey(Game)%0A    faction = models.ForeignKey(Faction)%0A%0A    def __str__(self):%0A        return self.name%0A%0A%0A
 class Player
@@ -1653,24 +1653,59 @@
  null=True)%0A
+    race = models.ForeignKey(Race)%0A
     server =

add race for players