<commit_before>from django.db import models

site_values = [(0, 'LIVE'),
                        (1, 'STAGING'),
                        (2, 'TEST'),
                        (3, 'DEVELOPMENT'),
                        (99, 'TO BE DELETED')]

class Channel(models.Model):
    """ A channel may represent a country, a category of visitor... anything."""
    name = models.CharField(max_length = 20, unique = True)
    parent = models.ForeignKey("Channel", related_name='child', blank=True, null=True)
    
    def __unicode__(self):
        return self.name
    
    def __str__(self):
        return self.__unicode__()
    
class Language(models.Model):
    """ Language is much as you'd expect """
    name = models.CharField(max_length = 20, unique = True)
    iso_code = models.CharField(max_length = 5, unique = True)
    fallback = models.ForeignKey("Language", related_name='child', blank=True, null=True)
    
    def __unicode__(self):
        return self.iso_code
    
    def __str__(self):
        return self.__unicode__()

class CMSComponent(models.Model):
    """ Represents a component in the CMS. A component is a large 'thing', e.g. a template
or big text whereas a Token is a small 'thing' - a small piece of text for example, no
more than 200 characters long."""
    cid = models.CharField(max_length = 100)
    
    def __unicode__(self):
        return self.cid
    
    def __str__(self):
        return self.__unicode__()
        
class CMSComponentValue(models.Model):
    component = models.ForeignKey(CMSComponent)
    channel = models.ForeignKey(Channel)
    site = models.IntegerField(choices = site_values, default = 0)
    value = models.TextField()
    
    def __unicode__(self):
        return "%s/%s" % (self.component.cid, self.channel)
    
    def __str__(self):
        return self.__unicode__()
       
class CMSToken(models.Model):
    """ Represents a token in the CMS. A component is a large 'thing', e.g. a template
whereas a Token is a small 'thing' - a small piece of text for example.
"""
    cid = models.CharField(max_length = 100)

    def __unicode__(self):
        return self.cid
    
    def __str__(self):
        return self.__unicode__()

class CMSTokenValue(models.Model):
    """ The value of a token in a given language. """
    token = models.ForeignKey(CMSToken)
    language = models.ForeignKey(Language)
    site = models.IntegerField(choices = site_values, default = 0)
    value = models.TextField()
    
    def __unicode__(self):
        return self.value
    
    def __str__(self):
        return self.__unicode__()

class URL(models.Model):
    """ Used to map to a component """
    name = models.CharField(max_length = 20)
    url = models.CharField(max_length = 255, unique = True)
    enabled = models.BooleanField(default = True)
    component_name = models.CharField(max_length = 20)

    def __unicode__(self):
        return self.url
    
    def __str__(self):
        return self.__unicode__()
    
class Slot(models.Model):
    """ Slots are regions in a page that have content that is chosen according to rules. """
    slot = models.CharField(max_length = 20)
    summary = models.CharField(max_length = 150)

    def __unicode__(self):
        return self.slot
    
    def __str__(self):
        return self.__unicode__()<commit_msg>neatened up admin<commit_after>from django.db import models

site_values = [(0, 'LIVE'),
                        (1, 'STAGING'),
                        (2, 'TEST'),
                        (3, 'DEVELOPMENT'),
                        (99, 'TO BE DELETED')]

class Channel(models.Model):
    """ A channel may represent a country, a category of visitor... anything."""
    name = models.CharField(max_length = 20, unique = True)
    parent = models.ForeignKey("Channel", related_name='child', blank=True, null=True)
    
    def __unicode__(self):
        return self.name
    
    def __str__(self):
        return self.__unicode__()
    
class Language(models.Model):
    """ Language is much as you'd expect """
    name = models.CharField(max_length = 20, unique = True)
    iso_code = models.CharField(max_length = 5, unique = True)
    fallback = models.ForeignKey("Language", related_name='child', blank=True, null=True)
    
    def __unicode__(self):
        return self.iso_code
    
    def __str__(self):
        return self.__unicode__()

class CMSComponent(models.Model):
    """ Represents a component in the CMS. A component is a large 'thing', e.g. a template
or big text whereas a Token is a small 'thing' - a small piece of text for example, no
more than 200 characters long."""
    cid = models.CharField(max_length = 100)
    
    def __unicode__(self):
        return self.cid
    
    def __str__(self):
        return self.__unicode__()
        
class CMSComponentValue(models.Model):
    component = models.ForeignKey(CMSComponent)
    channel = models.ForeignKey(Channel)
    site = models.IntegerField(choices = site_values, default = 0)
    value = models.TextField()
    
    def __unicode__(self):
        return "%s/%s" % (self.component.cid, self.channel)
    
    def __str__(self):
        return self.__unicode__()
       
class CMSToken(models.Model):
    """ Represents a token in the CMS. A component is a large 'thing', e.g. a template
whereas a Token is a small 'thing' - a small piece of text for example.
"""
    cid = models.CharField(max_length = 100)

    def __unicode__(self):
        return self.cid
    
    def __str__(self):
        return self.__unicode__()

class CMSTokenValue(models.Model):
    """ The value of a token in a given language. """
    token = models.ForeignKey(CMSToken)
    language = models.ForeignKey(Language)
    site = models.IntegerField(choices = site_values, default = 0)
    value = models.TextField()
    
    def __unicode__(self):
        return "%s/%s" % (self.token, self.language)
    
    def __str__(self):
        return self.__unicode__()

class URL(models.Model):
    """ Used to map to a component """
    name = models.CharField(max_length = 20)
    url = models.CharField(max_length = 255, unique = True)
    enabled = models.BooleanField(default = True)
    component_name = models.CharField(max_length = 20)

    def __unicode__(self):
        return self.url
    
    def __str__(self):
        return self.__unicode__()
    
class Slot(models.Model):
    """ Slots are regions in a page that have content that is chosen according to rules. """
    slot = models.CharField(max_length = 20)
    summary = models.CharField(max_length = 150)

    def __unicode__(self):
        return self.slot
    
    def __str__(self):
        return self.__unicode__()
{'fraction_non_alphanumeric': 0.10922730682670667, 'fraction_numerical': 0.010202550637659414, 'mean_word_length': 2.6626373626373625, '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': '6771452', 'n_tokens_mistral': 2039, 'n_tokens_neox': 1922, 'n_words': 575}