from django.db import models

# class Language(models.Model):
#     name = models.CharField(max_length=50)
#     paradigm = models.CharField(max_length=60)
#
#     def __str__(self):
#         return self.name


# Create your models here.
" Creating sepearte paradigm class to learn how to work with foreign keys...."


# WARNING: updating the code!!!

class Paradigm(models.Model):
    name = models.CharField(max_length=50)

    def __str__(self):
        return self.name


class Language(models.Model):
    name = models.CharField(max_length=50)
    paradigm = models.ForeignKey(Paradigm, on_delete=models.CASCADE)

    def __str__(self):
        return self.name


class Programmer(models.Model):
    name = models.CharField(max_length=50)
    languages = models.ManyToManyField(Language)

    def __str__(self):
        return self.name
