<commit_before>from datetime import date
import uuid

import django.utils
from django.conf import settings
from django.db import models

from django_countries.fields import CountryField

from .jacs import JACS_LEVEL_2

MAX_CHAR_LENGTH = 120
MAX_PHONE_LENGTH = 14
MAX_DIGITS = 10

GENDERS = (
        ('M', 'Male'),
        ('F', 'Female'),
        ('O', 'Other'),
        ('R', 'Rather not say'),
        )

FUND_CATEGORY = (
        ('A', 'Attending a conference/workshop'),
        ('H', 'Organising a conference/workshop (e.g. Software Carpentry)'),
        ('P', 'Policy related fund'),
        ('O', 'Other'),
        )

AD_STATUS = (
        ('U', 'Unprocessed'),  # Initial status
        ('V', 'Visible'),  # Fund is visible on map
        ('H', 'Hide'),  # Fund is invisible on map
        )

FUND_STATUS = (
        ('U', 'Unprocessed'),  # Initial status
        ('P', 'Processing'),  # When someone was assigned to review the request
        ('A', 'Approved'),  # Fund was approved. Funds are reserved.
        ('R', 'Reproved'),  # Fund was declided.
        ('F', 'Archived'),  # Approved funds with all claims and blog posts were processed. No funds are reserved.
        )

FUND_STATUS_LONG_DESCRIPTION = {
    'U': "We didn't start to process your request yet.",
    'P': "One of your staffs is reviewing your request. You should have our reply soon.",
    'A': "Your fund request was approved.",
    'R': "Your fund request was declided.",
    'F': "We archived your fund request since all the expense claims were processed."
    }


EXPENSE_STATUS = (
        ('W', 'Not submitted yet'),
        ('S', 'Submitted (awaiting processing)'),
        ('C', 'Administrator checking'),
        ('P', 'Authoriser checking'),
        ('A', 'Approved (submitted to finance)'),
        ('F', 'Finished'),
        )

FUNDS_FROM = (
    ('C', 'Continuing (claimedship)'),
    ('I', 'Core (Software Sustainability Institute)'),
    ('F', 'Grant (inauguration claimedship)'),
    )

GRANTS = (
    ('SSI1', 'Software Sustainability Institute - Phase 1'),
    ('SSI2', 'Software Sustainability Institute - Phase 2'),
    ('SSI3', 'Software Sustainability Institute - Phase 3'),
    )

BLOG_POST_STATUS = (
        ('U', 'Unprocessed'),
        ('R', 'On Google Drive (for review)'),
        ('L', 'On pipeline to be published'),
        ('P', 'Published'),
        ('D', 'Declined'),
        ('O', 'Out of date'),
        )


class Claimed(models.Model):
    """Describe a claimed."""

    class Meta:
        app_label = 'fat'

    # Authentication
    #
    # We use this to only allow claimed to access their own data.
    user = models.OneToOneField(settings.AUTH_USER_MODEL,
            null=True,
            blank=True)

    # Personal info (application details)
    forenames = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    surname = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    email = models.EmailField(
            blank=False)
    phone = models.CharField(max_length=MAX_CHAR_LENGTH,
                             blank=False,
                             help_text="The number that we can contact you.",
    )
    gender = models.CharField(choices=GENDERS,
            max_length=1,
            default="R")
    home_country = CountryField(
        blank=False,
        default='GB')  # Default for United Kingdom
    home_city = models.CharField(
        blank=False,
        max_length=MAX_CHAR_LENGTH)
    home_lon = models.FloatField(
            null=True,
            blank=True)
    home_lat = models.FloatField(
            null=True,
            blank=True)
    photo = models.FileField(
            upload_to='photos/',  # File will be uploaded to MEDIA_ROOT/photos
            null=True,
            blank=True)  # This need to be a JPG.

    # Professional info
    # JACS code for research_area.
    # https://www.hesa.ac.uk/jacs/
    research_area = models.TextField(
        help_text="Please describe your research"
    )
    research_area_code = models.CharField(choices=JACS_LEVEL_2,
                                          max_length=4,
                                          default="Y000")
    affiliation = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    funding = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    funding_notes = models.TextField(
            null=True,
            blank=True)
    work_description = models.TextField(blank=False)

    # Social media
    website = models.URLField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    website_feed = models.URLField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    orcid = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    github = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    gitlab = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    twitter = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    facebook = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)

    # Admin fields
    application_year = models.IntegerField(
                null=False,
                blank=False,
                default=date.today().year)
    selected = models.BooleanField(default=False)
    claimedship_grant = models.DecimalField(max_digits=MAX_DIGITS,
                                           decimal_places=2,
                                           null=False,<commit_msg>Make model less limited<commit_after>from datetime import date
import uuid

import django.utils
from django.conf import settings
from django.db import models

from django_countries.fields import CountryField

from .jacs import JACS_LEVEL_2

MAX_CHAR_LENGTH = 120
MAX_PHONE_LENGTH = 14
MAX_DIGITS = 10

GENDERS = (
        ('M', 'Male'),
        ('F', 'Female'),
        ('O', 'Other'),
        ('R', 'Rather not say'),
        )

FUND_CATEGORY = (
        ('A', 'Attending a conference/workshop'),
        ('H', 'Organising a conference/workshop (e.g. Software Carpentry)'),
        ('P', 'Policy related fund'),
        ('O', 'Other'),
        )

AD_STATUS = (
        ('U', 'Unprocessed'),  # Initial status
        ('V', 'Visible'),  # Fund is visible on map
        ('H', 'Hide'),  # Fund is invisible on map
        )

FUND_STATUS = (
        ('U', 'Unprocessed'),  # Initial status
        ('P', 'Processing'),  # When someone was assigned to review the request
        ('A', 'Approved'),  # Fund was approved. Funds are reserved.
        ('R', 'Reproved'),  # Fund was declided.
        ('F', 'Archived'),  # Approved funds with all claims and blog posts were processed. No funds are reserved.
        )

FUND_STATUS_LONG_DESCRIPTION = {
    'U': "We didn't start to process your request yet.",
    'P': "One of your staffs is reviewing your request. You should have our reply soon.",
    'A': "Your fund request was approved.",
    'R': "Your fund request was declided.",
    'F': "We archived your fund request since all the expense claims were processed."
    }


EXPENSE_STATUS = (
        ('W', 'Not submitted yet'),
        ('S', 'Submitted (awaiting processing)'),
        ('C', 'Administrator checking'),
        ('P', 'Authoriser checking'),
        ('A', 'Approved (submitted to finance)'),
        ('F', 'Finished'),
        )

FUNDS_FROM = (
    ('C', 'Continuing (claimedship)'),
    ('I', 'Core (Software Sustainability Institute)'),
    ('F', 'Grant (inauguration claimedship)'),
    )

GRANTS = (
    ('SSI1', 'Software Sustainability Institute - Phase 1'),
    ('SSI2', 'Software Sustainability Institute - Phase 2'),
    ('SSI3', 'Software Sustainability Institute - Phase 3'),
    )

BLOG_POST_STATUS = (
        ('U', 'Unprocessed'),
        ('R', 'On Google Drive (for review)'),
        ('L', 'On pipeline to be published'),
        ('P', 'Published'),
        ('D', 'Declined'),
        ('O', 'Out of date'),
        )


class Claimed(models.Model):
    """Describe a claimed."""

    class Meta:
        app_label = 'fat'

    # Authentication
    #
    # We use this to only allow claimed to access their own data.
    user = models.OneToOneField(settings.AUTH_USER_MODEL,
            null=True,
            blank=True)

    # Personal info (application details)
    forenames = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    surname = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=False)
    email = models.EmailField(
            blank=False)
    phone = models.CharField(max_length=MAX_CHAR_LENGTH,
                             blank=False,
                             help_text="The number that we can contact you.",
    )
    gender = models.CharField(choices=GENDERS,
            max_length=1,
            default="R")
    home_country = CountryField(
        blank=False,
        default='GB')  # Default for United Kingdom
    home_city = models.CharField(
        blank=False,
        max_length=MAX_CHAR_LENGTH)
    home_lon = models.FloatField(
            null=True,
            blank=True)
    home_lat = models.FloatField(
            null=True,
            blank=True)
    photo = models.FileField(
            upload_to='photos/',  # File will be uploaded to MEDIA_ROOT/photos
            null=True,
            blank=True)  # This need to be a JPG.

    # Professional info
    # JACS code for research_area.
    # https://www.hesa.ac.uk/jacs/
    research_area = models.TextField(
        blank=True,
        help_text="Please describe your research"
    )
    research_area_code = models.CharField(choices=JACS_LEVEL_2,
                                          max_length=4,
                                          default="Y000")
    affiliation = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    funding = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    funding_notes = models.TextField(
            null=True,
            blank=True)
    work_description = models.TextField(blank=True)

    # Social media
    website = models.URLField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    website_feed = models.URLField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    orcid = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    github = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    gitlab = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    twitter = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)
    facebook = models.CharField(max_length=MAX_CHAR_LENGTH,
            blank=True)

    # Admin fields
    application_year = models.IntegerField(
                null=False,
                blank=False,
                default=date.today().year)
    selected = models.BooleanField(default=False)
    claimedship_grant = models.DecimalField(max_digits=MAX_DIGITS,
                                           decimal_places=2,
                                           null=False,
{'fraction_non_alphanumeric': 0.11502581287926818, 'fraction_numerical': 0.0038040032605742235, 'mean_word_length': 2.239073041947785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1916337', 'n_tokens_mistral': 3258, 'n_tokens_neox': 3151, 'n_words': 811}