from django.db import models
from games.models import Game
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_countries.fields import CountryField

# Create your models here.


class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField()
    age = models.PositiveIntegerField()
    cv = models.TextField(max_length=300)
    games = models.ManyToManyField(Game)
    country = CountryField()  # profile.country.flag  profile.country.name

    # guilds = models.ManyToManyField(related_name=guilds)

    def __str__(self):
        return "%s: %s" % (self.id, self.user)


@receiver(post_save, sender=User)
def profile_creation(instance, created, *args, **kwargs):
    if created:
        Profile.objects.create(user=instance, age=0)

f25d77e0580d3e4a3d736a44f65e1edd92586a80
<mask token>


class Profile(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __str__(self):
        return '%s: %s' % (self.id, self.user)


<mask token>

<mask token>


class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField()
    age = models.PositiveIntegerField()
    cv = models.TextField(max_length=300)
    games = models.ManyToManyField(Game)
    country = CountryField()

    def __str__(self):
        return '%s: %s' % (self.id, self.user)


<mask token>

<mask token>


class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField()
    age = models.PositiveIntegerField()
    cv = models.TextField(max_length=300)
    games = models.ManyToManyField(Game)
    country = CountryField()

    def __str__(self):
        return '%s: %s' % (self.id, self.user)


@receiver(post_save, sender=User)
def profile_creation(instance, created, *args, **kwargs):
    if created:
        Profile.objects.create(user=instance, age=0)

from django.db import models
from games.models import Game
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_countries.fields import CountryField


class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField()
    age = models.PositiveIntegerField()
    cv = models.TextField(max_length=300)
    games = models.ManyToManyField(Game)
    country = CountryField()

    def __str__(self):
        return '%s: %s' % (self.id, self.user)


@receiver(post_save, sender=User)
def profile_creation(instance, created, *args, **kwargs):
    if created:
        Profile.objects.create(user=instance, age=0)

from django.db import models
from games.models import Game
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_countries.fields import CountryField

# Create your models here.


class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField()
    age = models.PositiveIntegerField()
    cv = models.TextField(max_length=300)
    games = models.ManyToManyField(Game)
    country = CountryField()  # profile.country.flag  profile.country.name

    # guilds = models.ManyToManyField(related_name=guilds)

    def __str__(self):
        return "%s: %s" % (self.id, self.user)


@receiver(post_save, sender=User)
def profile_creation(instance, created, *args, **kwargs):
    if created:
        Profile.objects.create(user=instance, age=0)
