<commit_before>from django.db import models
from django.contrib.auth.models import User


class Tdo(models.Model):
    tdo_id = models.IntegerField()  # TODO make unique?
    name = models.CharField(max_length=250)
    done = models.BooleanField(default=False)
    owner = models.ForeignKey(
        'TdoUser',
        on_delete=models.CASCADE,
    )


class TdoUser(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    tokens = models.TextField(default="")

    @staticmethod
    def create(
        username,
        email,
        password,
        first_name,
        last_name
    ):
        user = User.objects.create_user(
            email=email,
            username=username,
            password=password,
            first_name=first_name,
            last_name=last_name
        )
        user.is_active = False
        user.save()

        return TdoUser.objects.create(user=user)

    def add_token(self, token):
        pass  # TODO method to add a new token

    def get_tokens(self):
        # return self.tokens.split()
        pass  # TODO method to get a list of tokens<commit_msg>add TdoList model needs review and fix<commit_after>from django.db import models
from django.contrib.auth.models import User


class Tdo(models.Model):
    tdo_id = models.IntegerField()  # TODO make unique?
    name = models.CharField(max_length=250)
    done = models.BooleanField(default=False)
    owner = models.ForeignKey(
        'TdoUser',
        on_delete=models.CASCADE,
    )
    in_list = models.ForeignKey('TdoList', on_delete=models.CASCADE)

    @staticmethod
    def create(
            tdo_id,
            name,
            owner,
            add_to='default'):
        in_list = TdoList.objects.filter(owner=owner).get(name=add_to)
        return Tdo.objects.create(tdo_id, name, owner, in_list)


class TdoUser(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    tokens = models.TextField(default="")

    @staticmethod
    def create(
        username,
        email,
        password,
        first_name,
        last_name
    ):
        user = User.objects.create_user(
            email=email,
            username=username,
            password=password,
            first_name=first_name,
            last_name=last_name
        )
        user.is_active = False
        user.save()
        tdo_user = TdoUser.objects.create(user=user)
        TdoList.objects.create(name='default', owner=tdo_user)
        return tdo_user

    def add_token(self, token):
        pass  # TODO method to add a new token

    def get_tokens(self):
        # return self.tokens.split()
        pass  # TODO method to get a list of tokens


class TdoList(models.Model):
    name = models.CharField(max_length=250)
    owner = models.ForeignKey('TdoUser', on_delete=models.CASCADE)
{'fraction_non_alphanumeric': 0.09339887640449439, 'fraction_numerical': 0.0031601123595505617, 'mean_word_length': 2.339976553341149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4460537', 'n_tokens_mistral': 882, 'n_tokens_neox': 856, 'n_words': 181}