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


# User-related models
class User(models.Model):
    '''
    Represents an user. Both organizers and participants are considered as
    users. This allows usage of the same accounts for the users that became
    organizers later.
    '''

    # Fields accessible from AuthUser:

    # username
    # first_name
    # last_name
    # email
    # password
    # is_staff
    # is_active
    # is_superuser
    # last_login
    # date_joined

    authuser = models.OneToOneField(AuthUser)

    # personal info
    date_of_birth = models.DateTimeField(blank=True)
    sex = models.CharField(max_length=1, blank=True, choices=(('M', 'male'),
                                                              ('F', 'female')))
    social_security_number = models.CharField(max_length=11, blank=True)
    state_id_number = models.CharField(max_length=8, blank=True)

    competes = models.ManyToManyField('competitions.Competition',
                    through='competitions.CompetitionUserRegistration')

    # address information
    phone_number = models.CharField(max_length=30, blank=True)
    parent_phone_number = models.CharField(max_length=30, blank=True)
    address = models.ForeignKey('schools.Address')

    # school related info
    school = models.ForeignKey('schools.School', blank=True)
    school_class = models.CharField(max_length=20, blank=True)
    classlevel = models.CharField(max_length=2, blank=True,
                                  choices=(('Z2', 'Z2'),
                                           ('Z3', 'Z3'),
                                           ('Z4', 'Z4'),
                                           ('Z5', 'Z5'),
                                           ('Z6', 'Z6'),
                                           ('Z7', 'Z7'),
                                           ('Z8', 'Z8'),
                                           ('Z9', 'Z9'),
                                           ('S1', 'S1'),
                                           ('S2', 'S2'),
                                           ('S3', 'S3'),
                                           ('S4', 'S4')))

    # Fields added via foreign keys:

    #  camp_set
    #  campuserinvitation_set
    #  competitionuserregistration_set
    #  event_set
    #  eventuserregistration_set
    #  usersolution_set

    # Fields added via inheritance:

    #  organizer

    def __unicode__(self):
        return self.login


class Organizer(User):
    '''
    Represents an organizer. Organizer can organize multiple competitions
    or events.
    '''

    motto = models.CharField(max_length=50)

    # TODO: there are 2 data descriptors added via many-to-many relationship
    #       in this case it's organized_event_set (custom name due to
    #       the fact that optional parameter related_name was defined)
    #       and eventorgregistration_set
    #       Investigate!

    # Fields added via foreign keys:

    #  competitionorgregistration_set
    #  eventorgregistration_set
    #  organized_event_set
    #  registeredorg
    #  orgsolution_set
    #  post_set

    # Fields added via inheritance:

    #  user_ptr


# Register to the admin site
admin.site.register(User)
admin.site.register(Organizer)
<commit_msg>Use authuser.username when converting User to string<commit_after>from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User as AuthUser


# User-related models
class User(models.Model):
    '''
    Represents an user. Both organizers and participants are considered as
    users. This allows usage of the same accounts for the users that became
    organizers later.
    '''

    # Fields accessible from AuthUser:

    # username
    # first_name
    # last_name
    # email
    # password
    # is_staff
    # is_active
    # is_superuser
    # last_login
    # date_joined

    authuser = models.OneToOneField(AuthUser)

    # personal info
    date_of_birth = models.DateTimeField(blank=True)
    sex = models.CharField(max_length=1, blank=True, choices=(('M', 'male'),
                                                              ('F', 'female')))
    social_security_number = models.CharField(max_length=11, blank=True)
    state_id_number = models.CharField(max_length=8, blank=True)

    competes = models.ManyToManyField('competitions.Competition',
                    through='competitions.CompetitionUserRegistration')

    # address information
    phone_number = models.CharField(max_length=30, blank=True)
    parent_phone_number = models.CharField(max_length=30, blank=True)
    address = models.ForeignKey('schools.Address')

    # school related info
    school = models.ForeignKey('schools.School', blank=True)
    school_class = models.CharField(max_length=20, blank=True)
    classlevel = models.CharField(max_length=2, blank=True,
                                  choices=(('Z2', 'Z2'),
                                           ('Z3', 'Z3'),
                                           ('Z4', 'Z4'),
                                           ('Z5', 'Z5'),
                                           ('Z6', 'Z6'),
                                           ('Z7', 'Z7'),
                                           ('Z8', 'Z8'),
                                           ('Z9', 'Z9'),
                                           ('S1', 'S1'),
                                           ('S2', 'S2'),
                                           ('S3', 'S3'),
                                           ('S4', 'S4')))

    # Fields added via foreign keys:

    #  camp_set
    #  campuserinvitation_set
    #  competitionuserregistration_set
    #  event_set
    #  eventuserregistration_set
    #  usersolution_set

    # Fields added via inheritance:

    #  organizer

    def __unicode__(self):
        return self.authuser.username


class Organizer(User):
    '''
    Represents an organizer. Organizer can organize multiple competitions
    or events.
    '''

    motto = models.CharField(max_length=50)

    # TODO: there are 2 data descriptors added via many-to-many relationship
    #       in this case it's organized_event_set (custom name due to
    #       the fact that optional parameter related_name was defined)
    #       and eventorgregistration_set
    #       Investigate!

    # Fields added via foreign keys:

    #  competitionorgregistration_set
    #  eventorgregistration_set
    #  organized_event_set
    #  registeredorg
    #  orgsolution_set
    #  post_set

    # Fields added via inheritance:

    #  user_ptr


# Register to the admin site
admin.site.register(User)
admin.site.register(Organizer)

{'fraction_non_alphanumeric': 0.09059955588452998, 'fraction_numerical': 0.011250925240562546, 'mean_word_length': 1.7975155279503106, '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': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1626665', 'n_tokens_mistral': 1822, 'n_tokens_neox': 1722, 'n_words': 430}