<commit_before>from django.contrib.auth.models import (AbstractBaseUser, AbstractUser,
                                        BaseUserManager)
from django.db import connections, models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _


# Create your models here.
class Award(models.Model):
    name = models.CharField(max_length=255, null=False)
    description = models.TextField(default="")

    class Meta:
        verbose_name = _("Award")

    def __str__(self):
        return self.name

    def stringify(self):
        return {
            "id": self.id,
            "name": self.name,
            "description": self.description
        }

    def stringify_meta(self):
        return self.stringify()


class User(AbstractUser):
    nickname = models.CharField(
        _('nick_name'), max_length=255, null=False, unique=True)
    profile = models.TextField(_('profile'), default="")
    current_award = models.ForeignKey("UserAward", null=True)
    experience = models.IntegerField(_('experience'), default=0)

    REQUIRED_FIELDS = ['nickname']

    def get_full_name(self):
        return self.nickname

    def get_short_name(self):
        return self.nickname

    def __str__(self):
        return self.nickname

    def stringify(self):
        if self.current_award:
            current_award_str = self.current_award.stringify_meta(user=False)
        else:
            current_award_str = None

        available_awards = [
            ua.stringify_meta(user=False)
            for ua in UserAward.objects.filter(user_id=self)
        ]
        return {<commit_msg>SECURITY UPDATE: DROP CASCADE ON DELETE<commit_after>from django.contrib.auth.models import (AbstractBaseUser, AbstractUser,
                                        BaseUserManager)
from django.db import connections, models
from django.db.models import Q, DO_NOTHING, SET_NULL
from django.utils.translation import ugettext_lazy as _


# Create your models here.
class Award(models.Model):
    name = models.CharField(max_length=255, null=False)
    description = models.TextField(default="")

    class Meta:
        verbose_name = _("Award")

    def __str__(self):
        return self.name

    def stringify(self):
        return {
            "id": self.id,
            "name": self.name,
            "description": self.description
        }

    def stringify_meta(self):
        return self.stringify()


class User(AbstractUser):
    nickname = models.CharField(
        _('nick_name'), max_length=255, null=False, unique=True)
    profile = models.TextField(_('profile'), default="")
    current_award = models.ForeignKey("UserAward", null=True, on_delete=SET_NULL)
    experience = models.IntegerField(_('experience'), default=0)

    REQUIRED_FIELDS = ['nickname']

    def get_full_name(self):
        return self.nickname

    def get_short_name(self):
        return self.nickname

    def __str__(self):
        return self.nickname

    def stringify(self):
        if self.current_award:
            current_award_str = self.current_award.stringify_meta(user=False)
        else:
            current_award_str = None

        available_awards = [
            ua.stringify_meta(user=False)
            for ua in UserAward.objects.filter(user_id=self)
        ]
        return {
{'fraction_non_alphanumeric': 0.09855334538878843, 'fraction_numerical': 0.004219409282700422, 'mean_word_length': 2.6036916395222582, 'pattern_counts': {'":': 6, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1602299', 'n_tokens_mistral': 986, 'n_tokens_neox': 942, 'n_words': 206}